├── .devcontainer ├── Dockerfile ├── devcontainer.json └── install-dependencies.sh ├── .dockerignore ├── .gitattributes ├── .github ├── CODEOWNERS └── workflows │ ├── master-validation.yml │ ├── pr-validation.yml │ └── release.yml ├── .gitignore ├── .gitmodules ├── .golangci.yml ├── CODE_OF_CONDUCT.md ├── Dockerfile ├── LICENSE.TXT ├── Makefile ├── PROJECT ├── README.md ├── SECURITY.md ├── Taskfile.yml ├── Tiltfile ├── apis ├── consts.go ├── core │ └── v1 │ │ └── types.go ├── microsoft.compute │ ├── v1 │ │ ├── conversion.go │ │ ├── doc.go │ │ ├── groupversion_info.go │ │ ├── resources.go │ │ ├── virtualmachine_types.go │ │ ├── virtualmachinescaleset_types.go │ │ └── zz_generated.deepcopy.go │ └── v20191201 │ │ ├── conversion.go │ │ ├── doc.go │ │ ├── groupversion_info.go │ │ ├── virtualmachine_types.go │ │ ├── virtualmachinescaleset_types.go │ │ ├── zz_generated.conversion.go │ │ └── zz_generated.deepcopy.go ├── microsoft.network │ ├── v1 │ │ ├── backendaddresspool_types.go │ │ ├── conversion.go │ │ ├── doc.go │ │ ├── frontendipconfiguration_types.go │ │ ├── groupversion_info.go │ │ ├── inboundnatrule_types.go │ │ ├── loadbalancer_types.go │ │ ├── loadbalancingrule_types.go │ │ ├── networkinterface_types.go │ │ ├── networksecuritygroup_types.go │ │ ├── outboundrule_types.go │ │ ├── resources.go │ │ ├── route_types.go │ │ ├── routetable_types.go │ │ ├── securityrule_types.go │ │ ├── subnet_types.go │ │ ├── virtualnetwork_types.go │ │ ├── virtualnetwork_types_test.go │ │ ├── webhook.go │ │ └── zz_generated.deepcopy.go │ └── v20191101 │ │ ├── backendaddresspool_types.go │ │ ├── conversion.go │ │ ├── doc.go │ │ ├── frontendipconfiguration_types.go │ │ ├── groupversion_info.go │ │ ├── inboundnatrule_types.go │ │ ├── loadbalancer_types.go │ │ ├── loadbalancingrule_types.go │ │ ├── networkinterface_types.go │ │ ├── networksecuritygroup_types.go │ │ ├── outboundrule_types.go │ │ ├── route_types.go │ │ ├── routetable_types.go │ │ ├── securityrule_types.go │ │ ├── subnet_types.go │ │ ├── virtualnetwork_types.go │ │ ├── zz_generated.conversion.go │ │ └── zz_generated.deepcopy.go └── microsoft.resources │ ├── v1 │ ├── conversion.go │ ├── doc.go │ ├── groupversion_info.go │ ├── resourcegroup_types.go │ ├── resourcegroup_types_test.go │ ├── webhook.go │ └── zz_generated.deepcopy.go │ ├── v20150101 │ ├── conversion.go │ ├── doc.go │ ├── groupversion_info.go │ ├── resourcegroup_types.go │ ├── zz_generated.conversion.go │ └── zz_generated.deepcopy.go │ └── v20191001 │ ├── conversion.go │ ├── doc.go │ ├── groupversion_info.go │ ├── resourcegroup_types.go │ ├── zz_generated.conversion.go │ └── zz_generated.deepcopy.go ├── config ├── certmanager │ ├── certificate.yaml │ ├── kustomization.yaml │ └── kustomizeconfig.yaml ├── crd │ ├── bases │ │ ├── microsoft.compute.infra.azure.com_virtualmachines.yaml │ │ ├── microsoft.compute.infra.azure.com_virtualmachinescalesets.yaml │ │ ├── microsoft.network.infra.azure.com_backendaddresspools.yaml │ │ ├── microsoft.network.infra.azure.com_frontendipconfigurations.yaml │ │ ├── microsoft.network.infra.azure.com_inboundnatrules.yaml │ │ ├── microsoft.network.infra.azure.com_loadbalancers.yaml │ │ ├── microsoft.network.infra.azure.com_loadbalancingrules.yaml │ │ ├── microsoft.network.infra.azure.com_networkinterfaceipconfigurations.yaml │ │ ├── microsoft.network.infra.azure.com_networkinterfaces.yaml │ │ ├── microsoft.network.infra.azure.com_networksecuritygroups.yaml │ │ ├── microsoft.network.infra.azure.com_outboundrules.yaml │ │ ├── microsoft.network.infra.azure.com_routes.yaml │ │ ├── microsoft.network.infra.azure.com_routetables.yaml │ │ ├── microsoft.network.infra.azure.com_securityrules.yaml │ │ ├── microsoft.network.infra.azure.com_subnets.yaml │ │ ├── microsoft.network.infra.azure.com_virtualnetworks.yaml │ │ └── microsoft.resources.infra.azure.com_resourcegroups.yaml │ ├── kustomization.yaml │ ├── kustomizeconfig.yaml │ └── patches │ │ ├── cainjection_in_backendaddresspools.yaml │ │ ├── cainjection_in_frontendipconfigurations.yaml │ │ ├── cainjection_in_inboundnatrules.yaml │ │ ├── cainjection_in_loadbalancers.yaml │ │ ├── cainjection_in_loadbalancingrules.yaml │ │ ├── cainjection_in_networkinterfaces.yaml │ │ ├── cainjection_in_networksecuritygroups.yaml │ │ ├── cainjection_in_outboundrules.yaml │ │ ├── cainjection_in_resourcegroups.yaml │ │ ├── cainjection_in_routes.yaml │ │ ├── cainjection_in_routetables.yaml │ │ ├── cainjection_in_securityrules.yaml │ │ ├── cainjection_in_subnets.yaml │ │ ├── cainjection_in_virtualmachines.yaml │ │ ├── cainjection_in_virtualmachinescalesets.yaml │ │ ├── cainjection_in_virtualnetworks.yaml │ │ ├── webhook_in_backendaddresspools.yaml │ │ ├── webhook_in_frontendipconfigurations.yaml │ │ ├── webhook_in_inboundnatrules.yaml │ │ ├── webhook_in_loadbalancers.yaml │ │ ├── webhook_in_loadbalancingrules.yaml │ │ ├── webhook_in_networkinterfaces.yaml │ │ ├── webhook_in_networksecuritygroups.yaml │ │ ├── webhook_in_outboundrules.yaml │ │ ├── webhook_in_resourcegroups.yaml │ │ ├── webhook_in_routes.yaml │ │ ├── webhook_in_routetables.yaml │ │ ├── webhook_in_securityrules.yaml │ │ ├── webhook_in_subnets.yaml │ │ ├── webhook_in_virtualmachines.yaml │ │ ├── webhook_in_virtualmachinescalesets.yaml │ │ └── webhook_in_virtualnetworks.yaml ├── credentials │ ├── credentials.yaml │ └── kustomization.yaml ├── default │ ├── kustomization.yaml │ ├── manager_credentials_patch.yaml │ ├── manager_webhook_patch.yaml │ └── webhookcainjection_patch.yaml ├── manager │ ├── kustomization.yaml │ ├── manager.yaml │ ├── manager_auth_proxy_patch.yaml │ ├── manager_image_patch.yaml │ └── manager_pull_policy.yaml ├── prometheus │ ├── kustomization.yaml │ └── monitor.yaml ├── rbac │ ├── auth_proxy_role.yaml │ ├── auth_proxy_role_binding.yaml │ ├── auth_proxy_service.yaml │ ├── backendaddresspool_editor_role.yaml │ ├── backendaddresspool_viewer_role.yaml │ ├── frontendipconfiguration_editor_role.yaml │ ├── frontendipconfiguration_viewer_role.yaml │ ├── inboundnatrule_editor_role.yaml │ ├── inboundnatrule_viewer_role.yaml │ ├── kustomization.yaml │ ├── leader_election_role.yaml │ ├── leader_election_role_binding.yaml │ ├── loadbalancer_editor_role.yaml │ ├── loadbalancer_viewer_role.yaml │ ├── loadbalancingrule_editor_role.yaml │ ├── loadbalancingrule_viewer_role.yaml │ ├── networkinterface_editor_role.yaml │ ├── networkinterface_viewer_role.yaml │ ├── networkinterfaceipconfiguration_editor_role.yaml │ ├── networkinterfaceipconfiguration_viewer_role.yaml │ ├── networksecuritygroup_editor_role.yaml │ ├── networksecuritygroup_viewer_role.yaml │ ├── outboundrule_editor_role.yaml │ ├── outboundrule_viewer_role.yaml │ ├── resourcegroup_editor_role.yaml │ ├── resourcegroup_viewer_role.yaml │ ├── role.yaml │ ├── role_binding.yaml │ ├── route_editor_role.yaml │ ├── route_viewer_role.yaml │ ├── routetable_editor_role.yaml │ ├── routetable_viewer_role.yaml │ ├── securityrule_editor_role.yaml │ ├── securityrule_viewer_role.yaml │ ├── subnet_editor_role.yaml │ ├── subnet_viewer_role.yaml │ ├── virtualmachine_editor_role.yaml │ ├── virtualmachine_viewer_role.yaml │ ├── virtualmachinescaleset_editor_role.yaml │ ├── virtualmachinescaleset_viewer_role.yaml │ ├── virtualnetwork_editor_role.yaml │ └── virtualnetwork_viewer_role.yaml ├── samples │ ├── microsoft.compute_v20191201_virtualmachine.yaml │ ├── microsoft.compute_v20191201_virtualmachinescaleset.yaml │ ├── microsoft.network_v20191101_backendaddresspool.yaml │ ├── microsoft.network_v20191101_frontendipconfiguration.yaml │ ├── microsoft.network_v20191101_inboundnatrule.yaml │ ├── microsoft.network_v20191101_loadbalancer.yaml │ ├── microsoft.network_v20191101_loadbalancingrule.yaml │ ├── microsoft.network_v20191101_networkinterface.yaml │ ├── microsoft.network_v20191101_networksecuritygroup.yaml │ ├── microsoft.network_v20191101_outboundrule.yaml │ ├── microsoft.network_v20191101_route.yaml │ ├── microsoft.network_v20191101_routetable.yaml │ ├── microsoft.network_v20191101_securityrule.yaml │ ├── microsoft.network_v20191101_subnet.yaml │ ├── microsoft.network_v20191101_virtualnetwork.yaml │ ├── microsoft.resources_v20150101_resourcegroup.yaml │ └── microsoft.resources_v20191001_resourcegroup.yaml └── webhook │ ├── kustomization.yaml │ ├── kustomizeconfig.yaml │ ├── manifests.yaml │ └── service.yaml ├── controllers ├── generic_controller.go ├── generic_controller_test.go └── suite_test.go ├── dev.sh ├── docs ├── development.md ├── manual_resource_creation.md ├── readme.md └── release.md ├── go.mod ├── go.sum ├── hack ├── Makefile ├── README.md ├── boilerplate.go.txt ├── crossplane │ ├── .gitignore │ ├── go.mod │ └── go.sum ├── generated │ ├── .gitignore │ ├── Dockerfile │ ├── Makefile │ ├── _apis │ │ └── microsoft.resources │ │ │ └── v1alpha1api20200601 │ │ │ ├── groupversion_info.go │ │ │ ├── resourcegroup_arm_types.go │ │ │ └── resourcegroup_types.go │ ├── config │ │ ├── default │ │ │ └── kustomization.yaml │ │ ├── manager │ │ │ ├── kustomization.yaml │ │ │ ├── manager.yaml │ │ │ ├── manager_auth_proxy_patch.yaml │ │ │ ├── manager_image_patch.yaml │ │ │ └── manager_pull_policy.yaml │ │ ├── rbac │ │ │ ├── auth_proxy_role.yaml │ │ │ ├── auth_proxy_role_binding.yaml │ │ │ ├── auth_proxy_service.yaml │ │ │ ├── kustomization.yaml │ │ │ ├── leader_election_role.yaml │ │ │ ├── leader_election_role_binding.yaml │ │ │ ├── resourcegroup_editor_role.yaml │ │ │ ├── resourcegroup_viewer_role.yaml │ │ │ └── role_binding.yaml │ │ └── samples │ │ │ ├── microsoft.batch_v1alpha1api20170901_batchaccount.yaml │ │ │ ├── microsoft.batch_v1alpha1api20170901_batchaccountpool.yaml │ │ │ ├── microsoft.resources_v1alpha1api20200601_resourcegroup.yaml │ │ │ └── microsoft.storage_v1alpha1api20190401_storageaccount.yaml │ ├── controllers │ │ ├── controller_resources.go │ │ ├── crd_cosmosdb_test.go │ │ ├── crd_resourcegroup_test.go │ │ ├── crd_servicebus_test.go │ │ ├── crd_storageaccount_test.go │ │ ├── generic_controller.go │ │ ├── helpers.go │ │ ├── recordings │ │ │ ├── Test_CosmosDB_CRUD.yaml │ │ │ ├── Test_ResourceGroup_CRUD.yaml │ │ │ ├── Test_ServiceBus_Namespace_CRUD.yaml │ │ │ └── Test_StorageAccount_CRUD.yaml │ │ └── suite_test.go │ ├── go.mod │ ├── go.sum │ ├── main.go │ └── pkg │ │ ├── armclient │ │ ├── raw_client.go │ │ ├── raw_client_test.go │ │ ├── recordings │ │ │ ├── Test_NewResourceGroupDeployment.yaml │ │ │ └── Test_NewResourceGroupDeployment_Error.yaml │ │ ├── suite_test.go │ │ ├── template_client.go │ │ ├── template_client_test.go │ │ └── types.go │ │ ├── genruntime │ │ ├── arm_transformer.go │ │ ├── base_types.go │ │ ├── errors.go │ │ ├── errors_test.go │ │ ├── locatable_resource.go │ │ ├── resolved_references.go │ │ ├── resolver.go │ │ ├── resolver_test.go │ │ ├── resource_hierarchy.go │ │ ├── resource_hierarchy_test.go │ │ └── resource_reference.go │ │ ├── reconcilers │ │ └── azure_deployment_reconciler.go │ │ ├── reflecthelpers │ │ ├── reflect_helpers.go │ │ ├── reflect_helpers_test.go │ │ ├── reflect_visitor.go │ │ └── reflect_visitor_test.go │ │ ├── testcommon │ │ ├── arm_matcher.go │ │ ├── authorizer.go │ │ ├── azure_be_deleted_matcher.go │ │ ├── azure_be_provisioned_matcher.go │ │ ├── be_deleted_matcher.go │ │ ├── be_provisioned_matcher.go │ │ ├── ensure.go │ │ ├── kube_matcher.go │ │ ├── kube_test_context.go │ │ ├── kube_test_context_envtest.go │ │ ├── kube_test_context_real.go │ │ ├── resource_namer.go │ │ ├── test_context.go │ │ └── wait.go │ │ └── util │ │ ├── kubeclient │ │ └── kube_client.go │ │ └── patch │ │ ├── patch.go │ │ ├── patch_test.go │ │ └── utils.go └── generator │ ├── Makefile │ ├── azure-arm.yaml │ ├── azure-crossplane.yaml │ ├── azure-stack.yaml │ ├── cmd │ ├── gen_kustomize.go │ ├── gen_types.go │ └── root.go │ ├── go.mod │ ├── go.sum │ ├── main.go │ ├── pkg │ ├── astbuilder │ │ ├── assignments.go │ │ ├── builder.go │ │ ├── calls.go │ │ ├── comments.go │ │ ├── comments_test.go │ │ ├── conditions.go │ │ ├── func_details.go │ │ ├── lists.go │ │ ├── literals.go │ │ ├── literals_test.go │ │ └── maps.go │ ├── astmodel │ │ ├── allof_type.go │ │ ├── allof_type_test.go │ │ ├── arm_spec_interface.go │ │ ├── arm_type_helpers.go │ │ ├── armconversion │ │ │ ├── arm_conversion_function.go │ │ │ ├── convert_from_arm_function_builder.go │ │ │ ├── convert_to_arm_function_builder.go │ │ │ ├── create_empty_arm_value_function.go │ │ │ └── shared.go │ │ ├── array_type.go │ │ ├── array_type_test.go │ │ ├── code_generation_context.go │ │ ├── conversion_function_builder.go │ │ ├── enum_type.go │ │ ├── enum_type_test.go │ │ ├── enum_value.go │ │ ├── errored_type.go │ │ ├── errored_type_test.go │ │ ├── external_package_reference.go │ │ ├── external_package_reference_test.go │ │ ├── file_definition.go │ │ ├── file_definition_test.go │ │ ├── flagged_type.go │ │ ├── flagged_type_test.go │ │ ├── function.go │ │ ├── function_container.go │ │ ├── function_test.go │ │ ├── generation_consts.go │ │ ├── go_source_file.go │ │ ├── identifier_factory.go │ │ ├── identifier_factory_test.go │ │ ├── interface_implementation.go │ │ ├── interface_implementer.go │ │ ├── interface_implementer_test.go │ │ ├── json_type.go │ │ ├── known_locals_set.go │ │ ├── known_locals_set_test.go │ │ ├── kubebuilder_validations.go │ │ ├── kubebuilder_validations_test.go │ │ ├── kubernetes_resource_interface.go │ │ ├── local_package_reference.go │ │ ├── local_package_reference_test.go │ │ ├── map_type.go │ │ ├── map_type_test.go │ │ ├── meta_type.go │ │ ├── meta_type_test.go │ │ ├── object_type.go │ │ ├── object_type_serialization_test_case.go │ │ ├── object_type_test.go │ │ ├── one_of_json_marshal_function.go │ │ ├── oneof_type.go │ │ ├── oneof_type_test.go │ │ ├── optional_type.go │ │ ├── package_definition.go │ │ ├── package_definition_test.go │ │ ├── package_import.go │ │ ├── package_import_set.go │ │ ├── package_import_set_test.go │ │ ├── package_import_test.go │ │ ├── package_reference.go │ │ ├── package_reference_set.go │ │ ├── package_reference_set_test.go │ │ ├── package_reference_test.go │ │ ├── primitive_type.go │ │ ├── primitive_type_test.go │ │ ├── property_container.go │ │ ├── property_definition.go │ │ ├── property_definition_test.go │ │ ├── reference_graph.go │ │ ├── reference_graph_test.go │ │ ├── resource_type.go │ │ ├── resource_type_test.go │ │ ├── std_references.go │ │ ├── storage_conversion_context.go │ │ ├── storage_conversion_endpoint.go │ │ ├── storage_conversion_factories.go │ │ ├── storage_conversion_function.go │ │ ├── storage_conversion_function_test.go │ │ ├── storage_package_reference.go │ │ ├── storage_package_reference_test.go │ │ ├── test_case.go │ │ ├── test_case_test.go │ │ ├── test_file_definition.go │ │ ├── testdata │ │ │ ├── ConvertBetweenAliasAndAliasType.golden │ │ │ ├── ConvertBetweenAliasAndBaseType.golden │ │ │ ├── ConvertBetweenAliasAndOptionalAliasType.golden │ │ │ ├── ConvertBetweenEnumAndBaseType.golden │ │ │ ├── ConvertBetweenEnumAndOptionalBaseType.golden │ │ │ ├── ConvertBetweenOptionalAliasAndBaseType.golden │ │ │ ├── ConvertBetweenOptionalAliasAndOptionalAliasType.golden │ │ │ ├── ConvertBetweenOptionalAliasAndOptionalBaseType.golden │ │ │ ├── ConvertBetweenOptionalEnumAndBaseType.golden │ │ │ ├── ConvertBetweenOptionalEnumAndOptionalBaseType.golden │ │ │ ├── ConvertBetweenOptionalEnumAndOptionalEnum.golden │ │ │ ├── ConvertBetweenOptionalObjectAndOptionalObject.golden │ │ │ ├── ConvertBetweenRequiredEnumAndOptionalEnum.golden │ │ │ ├── ConvertBetweenRequiredEnumAndRequiredEnum.golden │ │ │ ├── ConvertBetweenRequiredObjectAndOptionalObject.golden │ │ │ ├── ConvertBetweenRequiredObjectAndRequiredObject.golden │ │ │ ├── NastyTest.golden │ │ │ ├── SetArrayOfOptionalFromArrayOfRequired.golden │ │ │ ├── SetArrayOfRequiredFromArrayOfOptional.golden │ │ │ ├── SetArrayOfRequiredFromArrayOfRequired.golden │ │ │ ├── SetIntFromInt.golden │ │ │ ├── SetIntFromOptionalInt.golden │ │ │ ├── SetMapOfOptionalFromMapOfRequired.golden │ │ │ ├── SetMapOfRequiredFromMapOfOptional.golden │ │ │ ├── SetMapOfRequiredFromMapOfRequired.golden │ │ │ ├── SetOptionalStringFromOptionalString.golden │ │ │ ├── SetOptionalStringFromString.golden │ │ │ ├── SetStringFromOptionalString.golden │ │ │ └── SetStringFromString.golden │ │ ├── type.go │ │ ├── type_association.go │ │ ├── type_association_test.go │ │ ├── type_definition.go │ │ ├── type_definition_test.go │ │ ├── type_flag.go │ │ ├── type_flag_test.go │ │ ├── type_merger.go │ │ ├── type_merger_test.go │ │ ├── type_name.go │ │ ├── type_name_queue.go │ │ ├── type_name_queue_test.go │ │ ├── type_name_set.go │ │ ├── type_name_test.go │ │ ├── type_set.go │ │ ├── type_set_test.go │ │ ├── type_test.go │ │ ├── type_visitor.go │ │ ├── type_visitor_builder.go │ │ ├── type_visitor_test.go │ │ ├── type_walker.go │ │ ├── type_walker_test.go │ │ ├── types.go │ │ ├── types_test.go │ │ └── validated_type.go │ ├── codegen │ │ ├── code_generator.go │ │ ├── code_generator_test.go │ │ ├── crossplane_pipeline_add_at_provider.go │ │ ├── crossplane_pipeline_add_embedded_resource_spec.go │ │ ├── crossplane_pipeline_add_embedded_resource_status.go │ │ ├── crossplane_pipeline_add_for_provider.go │ │ ├── crossplane_pipeline_add_owner_properties.go │ │ ├── embeddedresources │ │ │ ├── remove_empty_objects.go │ │ │ ├── remover.go │ │ │ ├── renamer.go │ │ │ └── renamer_test.go │ │ ├── golden_files_test.go │ │ ├── pipeline_add_arm_conversion_interface.go │ │ ├── pipeline_apply_export_filters.go │ │ ├── pipeline_apply_kubernetes_resource_interface.go │ │ ├── pipeline_apply_property_rewrites.go │ │ ├── pipeline_assert_types_collection_valid.go │ │ ├── pipeline_augment_status.go │ │ ├── pipeline_augment_status_test.go │ │ ├── pipeline_check_for_anytype.go │ │ ├── pipeline_check_for_anytype_test.go │ │ ├── pipeline_convert_allof_and_oneof_to_objects.go │ │ ├── pipeline_convert_allof_and_oneof_to_objects_test.go │ │ ├── pipeline_create_arm_types.go │ │ ├── pipeline_create_storage_types.go │ │ ├── pipeline_delete_generated_code.go │ │ ├── pipeline_determine_resource_ownership.go │ │ ├── pipeline_ensure_type_has_arm_type.go │ │ ├── pipeline_export_controller_type_registrations.go │ │ ├── pipeline_export_generated_code.go │ │ ├── pipeline_factory_test.go │ │ ├── pipeline_flatten_resources.go │ │ ├── pipeline_improve_resource_pluralization.go │ │ ├── pipeline_json_serialization_test_cases.go │ │ ├── pipeline_load_schema.go │ │ ├── pipeline_mark_storage_version.go │ │ ├── pipeline_name_types_for_crd.go │ │ ├── pipeline_remove_embedded_resources.go │ │ ├── pipeline_remove_type_aliases.go │ │ ├── pipeline_replace_anytype_with_json.go │ │ ├── pipeline_replace_anytype_with_json_test.go │ │ ├── pipeline_report_type_versions.go │ │ ├── pipeline_simplify_definitions.go │ │ ├── pipeline_simplify_definitions_test.go │ │ ├── pipeline_stage.go │ │ ├── pipeline_strip_unused_types.go │ │ ├── pipeline_strip_unused_types_test.go │ │ ├── pipeline_target.go │ │ ├── resource_registration_file.go │ │ ├── testdata │ │ │ ├── .gitattributes │ │ │ ├── ARMCodeGeneratorPipeline.golden │ │ │ ├── AdditionalProperties │ │ │ │ ├── Generates_field_if_other_fields_present.golden │ │ │ │ ├── Generates_field_if_other_fields_present.json │ │ │ │ ├── Generates_map[string]interface{}_if_unset_and_no_other_fields_present.golden │ │ │ │ ├── Generates_map[string]interface{}_if_unset_and_no_other_fields_present.json │ │ │ │ ├── Generates_map_type_if_no_other_fields_present.golden │ │ │ │ ├── Generates_map_type_if_no_other_fields_present.json │ │ │ │ ├── Generates_nothing_if_set_to_'false'.golden │ │ │ │ ├── Generates_nothing_if_set_to_'false'.json │ │ │ │ ├── Generates_nothing_if_unset_and_other_fields_present.golden │ │ │ │ └── Generates_nothing_if_unset_and_other_fields_present.json │ │ │ ├── AllOf │ │ │ │ ├── AllOf_collapses_duplicate_named_types.golden │ │ │ │ ├── AllOf_collapses_duplicate_named_types.json │ │ │ │ ├── AllOf_collapses_duplicate_unnamed_types.golden │ │ │ │ ├── AllOf_collapses_duplicate_unnamed_types.json │ │ │ │ ├── AllOf_generates_wrapper_type.golden │ │ │ │ ├── AllOf_generates_wrapper_type.json │ │ │ │ ├── AllOf_handles_properties_on_owning_node.golden │ │ │ │ ├── AllOf_handles_properties_on_owning_node.json │ │ │ │ ├── AllOf_ignores_description_only_schema.golden │ │ │ │ ├── AllOf_ignores_description_only_schema.json │ │ │ │ ├── AllOf_turns_map_type_back_into_additionalProperties.golden │ │ │ │ └── AllOf_turns_map_type_back_into_additionalProperties.json │ │ │ ├── ArmResource │ │ │ │ ├── Arm_oneof_resource_conversion_on_arm_type_only.json │ │ │ │ ├── Arm_oneof_resource_conversion_on_arm_type_only_azure.golden │ │ │ │ ├── Arm_oneof_resource_conversion_on_arm_type_only_crossplane.golden │ │ │ │ ├── Arm_test_dependent_resource_and_ownership.json │ │ │ │ ├── Arm_test_dependent_resource_and_ownership_azure.golden │ │ │ │ ├── Arm_test_dependent_resource_and_ownership_crossplane.golden │ │ │ │ ├── Arm_test_embedded_resource_empty_objecttype_removed.json │ │ │ │ ├── Arm_test_embedded_resource_empty_objecttype_removed_azure.golden │ │ │ │ ├── Arm_test_embedded_resource_empty_objecttype_removed_crossplane.golden │ │ │ │ ├── Arm_test_embedded_resource_has_embedded_resource_inside.json │ │ │ │ ├── Arm_test_embedded_resource_has_embedded_resource_inside_azure.golden │ │ │ │ ├── Arm_test_embedded_resource_has_embedded_resource_inside_crossplane.golden │ │ │ │ ├── Arm_test_embedded_resource_multiple_contexts.json │ │ │ │ ├── Arm_test_embedded_resource_multiple_contexts_azure.golden │ │ │ │ ├── Arm_test_embedded_resource_multiple_contexts_crossplane.golden │ │ │ │ ├── Arm_test_embedded_resource_removed.json │ │ │ │ ├── Arm_test_embedded_resource_removed_azure.golden │ │ │ │ ├── Arm_test_embedded_resource_removed_crossplane.golden │ │ │ │ ├── Arm_test_embedded_subresource.json │ │ │ │ ├── Arm_test_embedded_subresource_azure.golden │ │ │ │ ├── Arm_test_embedded_subresource_crossplane.golden │ │ │ │ ├── Arm_test_embedded_subresource_same_properties.json │ │ │ │ ├── Arm_test_embedded_subresource_same_properties_azure.golden │ │ │ │ ├── Arm_test_embedded_subresource_same_properties_crossplane.golden │ │ │ │ ├── Arm_test_simple_resource_array_properties.json │ │ │ │ ├── Arm_test_simple_resource_array_properties_azure.golden │ │ │ │ ├── Arm_test_simple_resource_array_properties_crossplane.golden │ │ │ │ ├── Arm_test_simple_resource_complex_properties.json │ │ │ │ ├── Arm_test_simple_resource_complex_properties_azure.golden │ │ │ │ ├── Arm_test_simple_resource_complex_properties_crossplane.golden │ │ │ │ ├── Arm_test_simple_resource_json_fields.json │ │ │ │ ├── Arm_test_simple_resource_json_fields_azure.golden │ │ │ │ ├── Arm_test_simple_resource_json_fields_crossplane.golden │ │ │ │ ├── Arm_test_simple_resource_map_properties.json │ │ │ │ ├── Arm_test_simple_resource_map_properties_azure.golden │ │ │ │ ├── Arm_test_simple_resource_map_properties_crossplane.golden │ │ │ │ ├── Arm_test_simple_resource_renders_spec.json │ │ │ │ ├── Arm_test_simple_resource_renders_spec_azure.golden │ │ │ │ ├── Arm_test_simple_resource_renders_spec_crossplane.golden │ │ │ │ └── config.yaml │ │ │ ├── EmbeddedTypes │ │ │ │ ├── Embedded_type_simple_resource.golden │ │ │ │ ├── Embedded_type_simple_resource.json │ │ │ │ └── config.yaml │ │ │ ├── Enum │ │ │ │ ├── Boolean_enum.golden │ │ │ │ ├── Boolean_enum.json │ │ │ │ ├── Boolean_enum_value_with_quotes.golden │ │ │ │ ├── Boolean_enum_value_with_quotes.json │ │ │ │ ├── Enum_with_star_value.golden │ │ │ │ └── Enum_with_star_value.json │ │ │ ├── EnumNames │ │ │ │ ├── Multi_valued_enum_name.golden │ │ │ │ ├── Multi_valued_enum_name.json │ │ │ │ ├── Single_valued_enum_name.golden │ │ │ │ ├── Single_valued_enum_name.json │ │ │ │ └── config.yaml │ │ │ ├── OneOf │ │ │ │ ├── OneOf_collapses_duplicate_named_types.golden │ │ │ │ ├── OneOf_collapses_duplicate_named_types.json │ │ │ │ ├── OneOf_collapses_duplicate_unnamed_types.golden │ │ │ │ ├── OneOf_collapses_duplicate_unnamed_types.json │ │ │ │ ├── OneOf_generates_wrapper_for_inner_properties.golden │ │ │ │ ├── OneOf_generates_wrapper_for_inner_properties.json │ │ │ │ ├── OneOf_generates_wrapper_type.golden │ │ │ │ ├── OneOf_generates_wrapper_type.json │ │ │ │ ├── OneOf_generates_wrapper_type_with_named_properties_from_anonymous_types.golden │ │ │ │ ├── OneOf_generates_wrapper_type_with_named_properties_from_anonymous_types.json │ │ │ │ ├── OneOf_handles_properties_on_owning_node.golden │ │ │ │ ├── OneOf_handles_properties_on_owning_node.json │ │ │ │ ├── OneOf_preserves_names.golden │ │ │ │ └── OneOf_preserves_names.json │ │ │ ├── RemoveTypeAliasesPipeline │ │ │ │ ├── RemoveTypeAliases_all_aliases_are_inlined.golden │ │ │ │ ├── RemoveTypeAliases_all_aliases_are_inlined.json │ │ │ │ ├── RemoveTypeAliases_removes_type_alias.golden │ │ │ │ └── RemoveTypeAliases_removes_type_alias.json │ │ │ ├── TestCodeGeneratorPipeline.golden │ │ │ ├── UnreferencedDefinitions │ │ │ │ ├── unreferenced_definitions_are_not_generated.golden │ │ │ │ └── unreferenced_definitions_are_not_generated.json │ │ │ └── Validations │ │ │ │ ├── Enums_have_required_validation.golden │ │ │ │ ├── Enums_have_required_validation.json │ │ │ │ ├── Optional_properties_are_pointers.golden │ │ │ │ ├── Optional_properties_are_pointers.json │ │ │ │ ├── Optional_unknown_type_is_generated_as_interface.golden │ │ │ │ ├── Optional_unknown_type_is_generated_as_interface.json │ │ │ │ ├── Required_properties_have_appropriate_comment.golden │ │ │ │ ├── Required_properties_have_appropriate_comment.json │ │ │ │ ├── Validate_nested_types.golden │ │ │ │ ├── Validate_nested_types.json │ │ │ │ ├── Validate_property_type.golden │ │ │ │ └── Validate_property_type.json │ │ └── version.go │ ├── config │ │ ├── configuration.go │ │ ├── configuration_private_test.go │ │ ├── configuration_test.go │ │ ├── create_globbing_regex_test.go │ │ ├── export_filter.go │ │ ├── type_filter.go │ │ ├── type_matcher.go │ │ ├── type_matcher_test.go │ │ ├── type_transformer.go │ │ └── type_transformer_test.go │ ├── jsonast │ │ ├── jsonast.go │ │ ├── object_type_of_test.go │ │ ├── schema.json │ │ ├── schema_abstraction.go │ │ ├── schema_abstraction_gojson.go │ │ ├── schema_abstraction_openapi.go │ │ ├── swagger_type_extractor.go │ │ ├── swagger_type_extractor_test.go │ │ └── versionof_test.go │ ├── reporting │ │ ├── table.go │ │ ├── table_test.go │ │ └── testdata │ │ │ ├── TestTable_StepByStep_GivesExpectedResults_step_0.golden │ │ │ ├── TestTable_StepByStep_GivesExpectedResults_step_1.golden │ │ │ ├── TestTable_StepByStep_GivesExpectedResults_step_10.golden │ │ │ ├── TestTable_StepByStep_GivesExpectedResults_step_2.golden │ │ │ ├── TestTable_StepByStep_GivesExpectedResults_step_3.golden │ │ │ ├── TestTable_StepByStep_GivesExpectedResults_step_4.golden │ │ │ ├── TestTable_StepByStep_GivesExpectedResults_step_5.golden │ │ │ ├── TestTable_StepByStep_GivesExpectedResults_step_6.golden │ │ │ ├── TestTable_StepByStep_GivesExpectedResults_step_7.golden │ │ │ ├── TestTable_StepByStep_GivesExpectedResults_step_8.golden │ │ │ └── TestTable_StepByStep_GivesExpectedResults_step_9.golden │ └── xcobra │ │ ├── context.go │ │ ├── exit_handler.go │ │ └── noop_handler.go │ └── spec │ ├── case-study-chained-storage-versions.md │ ├── case-study-fixed-storage-version.md │ ├── case-study-rolling-storage-versions.md │ ├── crossplane.md │ ├── defaulter-validator.md │ ├── images │ ├── case-study-chained-storage │ │ ├── 2011-01-01.dot │ │ ├── 2011-01-01.png │ │ ├── 2012-02-02.dot │ │ ├── 2012-02-02.png │ │ ├── 2013-03-03.dot │ │ ├── 2013-03-03.png │ │ ├── 2014-04-04-preview.dot │ │ ├── 2014-04-04-preview.png │ │ ├── 2014-04-04.dot │ │ ├── 2014-04-04.png │ │ ├── 2015-05-05-alternate.dot │ │ ├── 2015-05-05-alternate.png │ │ ├── 2015-05-05.dot │ │ ├── 2015-05-05.png │ │ ├── 2016-06-06.dot │ │ ├── 2016-06-06.png │ │ ├── 2017-07-07.dot │ │ ├── 2017-07-07.png │ │ ├── 2018-08-08.dot │ │ ├── 2018-08-08.png │ │ ├── 2019-09-09.dot │ │ └── 2019-09-09.png │ ├── case-study-fixed-storage │ │ ├── 2011-01-01.dot │ │ ├── 2011-01-01.png │ │ ├── 2012-02-02.dot │ │ ├── 2012-02-02.png │ │ ├── 2013-03-03.dot │ │ ├── 2013-03-03.png │ │ ├── 2014-04-04-preview.dot │ │ ├── 2014-04-04-preview.png │ │ ├── 2014-04-04.dot │ │ ├── 2014-04-04.png │ │ ├── 2015-05-05.dot │ │ ├── 2015-05-05.png │ │ ├── 2016-06-06.dot │ │ ├── 2016-06-06.png │ │ ├── 2017-07-07.dot │ │ ├── 2017-07-07.png │ │ ├── 2018-08-08.dot │ │ ├── 2018-08-08.png │ │ ├── 2019-09-09.dot │ │ └── 2019-09-09.png │ ├── case-study-rolling-storage │ │ ├── 2011-01-01.dot │ │ ├── 2011-01-01.png │ │ ├── 2012-02-02.dot │ │ ├── 2012-02-02.png │ │ ├── 2013-03-03.dot │ │ ├── 2013-03-03.png │ │ ├── 2014-04-04-preview.dot │ │ ├── 2014-04-04-preview.png │ │ ├── 2014-04-04.dot │ │ ├── 2014-04-04.png │ │ ├── 2015-05-05.dot │ │ ├── 2015-05-05.png │ │ ├── 2016-06-06.dot │ │ ├── 2016-06-06.png │ │ ├── 2017-07-07.dot │ │ ├── 2017-07-07.png │ │ ├── 2018-08-08.dot │ │ ├── 2018-08-08.png │ │ ├── 2019-09-09.dot │ │ └── 2019-09-09.png │ └── versioning │ │ ├── conversions.dot │ │ ├── conversions.png │ │ ├── direct-conversion.png │ │ ├── direct-conversion.seq │ │ ├── golden-tests-from-latest.dot │ │ ├── golden-tests-from-latest.png │ │ ├── golden-tests-to-latest.dot │ │ ├── golden-tests-to-latest.png │ │ ├── multiple-step-conversion.png │ │ ├── multiple-step-conversion.seq │ │ ├── property-mapping-flowchart.dot │ │ ├── property-mapping-flowchart.png │ │ ├── two-step-conversion.png │ │ ├── two-step-conversion.seq │ │ ├── two-step-reverse-conversion.png │ │ └── two-step-reverse-conversion.seq │ ├── type_references_and_ownership.md │ └── versioning.md ├── internal └── test │ └── test.go ├── main.go ├── pkg ├── util │ ├── ctrlutil │ │ └── controller.go │ ├── ownerutil │ │ └── ownerutil.go │ ├── patch │ │ ├── patch.go │ │ └── patch_test.go │ └── statusutil │ │ └── status.go ├── xform │ ├── type_refs.go │ ├── type_refs_test.go │ ├── xform.go │ └── xform_test.go └── zips │ ├── client.go │ ├── duration │ ├── duration.go │ └── duration_test.go │ ├── env.go │ ├── template.go │ ├── template_int_test.go │ ├── template_test.go │ ├── testdata │ └── resource_group_deployment.json │ ├── types.go │ ├── types_test.go │ └── zips.go ├── scripts ├── apply_cert_and_secrets.sh ├── check_headers.py ├── create_testing_creds.sh ├── deploy_testing_secret.sh ├── fetch_ext_bins.sh ├── go_install.sh └── kind-with-registry.sh ├── tools.mk └── workspace.code-workspace /.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore everything 2 | ** 3 | 4 | # Allow only these 5 | !/apis/** 6 | !/controllers/** 7 | !/internal/** 8 | !/pkg/** 9 | !/main.go 10 | !/go.mod 11 | !/go.sum -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh text eol=LF 2 | Makefile text eol=LF 3 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # This is a comment. 2 | # Each line is a file pattern followed by one or more owners. 3 | 4 | # These owners will be the default owners for everything in 5 | # the repo. Unless a later match takes precedence, 6 | * @devigned 7 | 8 | # Section for specific ownership of the code generator 9 | /hack/ @matthchr @porges @theunrepentantgeek @devigned @babbageclunk 10 | -------------------------------------------------------------------------------- /.github/workflows/pr-validation.yml: -------------------------------------------------------------------------------- 1 | name: pr-validation 2 | on: 3 | push: 4 | branches: 5 | - master 6 | 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | test-generator: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout code 16 | uses: actions/checkout@v2 17 | with: 18 | submodules: 'true' 19 | 20 | - name: Build devcontainer image 21 | run: docker build --tag devcontainer:1.0 .devcontainer 22 | 23 | - name: Run CI tasks 24 | run: docker run -w /workspace -v $GITHUB_WORKSPACE:/workspace -e AZURE_TENANT_ID -e AZURE_CLIENT_ID -e AZURE_CLIENT_SECRET -e AZURE_SUBSCRIPTION_ID devcontainer:1.0 task ci 25 | 26 | - name: Upload code coverage to Codecov 27 | run: bash <(curl -s https://codecov.io/bash) 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, built with `go test -c` 9 | *.test 10 | 11 | # go-task file hashes 12 | .task/ 13 | 14 | # Output of the go coverage tool, specifically when used with LiteIDE 15 | *.out 16 | *.lcov 17 | 18 | # Dependency directories (remove the comment below to include it) 19 | # vendor/ 20 | 21 | # vscode nonsense 22 | .vscode 23 | # goland nonsense 24 | .idea 25 | # bins not allowed 26 | bin 27 | # osx nonsense 28 | .DS_Store 29 | # built from the makefile 30 | .k8sinfra.cluster 31 | .env 32 | 33 | pki/certs 34 | 35 | dist 36 | 37 | template.json 38 | 39 | hack/tools 40 | 41 | .tiltbuild 42 | 43 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "hack/generator/azure-rest-api-specs"] 2 | path = hack/generator/specs/azure-rest-api-specs 3 | url = https://github.com/Azure/azure-rest-api-specs 4 | [submodule "hack/generator/specs/azure-resource-manager-schemas"] 5 | path = hack/generator/specs/azure-resource-manager-schemas 6 | url = https://github.com/Azure/azure-resource-manager-schemas 7 | -------------------------------------------------------------------------------- /.golangci.yml: -------------------------------------------------------------------------------- 1 | run: 2 | deadline: 5m 3 | allow-parallel-runners: true 4 | 5 | linters: 6 | enable: 7 | - gofmt 8 | - megacheck 9 | presets: 10 | - bugs 11 | - unused 12 | disable: 13 | - scopelint # obsoleted by exportloopref 14 | 15 | linters-settings: 16 | govet: 17 | check-shadowing: true 18 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Azure K8s Infra (Archived) 2 | 3 | ⚠ The code from this repository has now been integrated into [Azure/azure-service-operator](https://github.com/Azure/azure-service-operator/). 4 | -------------------------------------------------------------------------------- /apis/consts.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package apis 7 | 8 | const ( 9 | // AzureInfraFinalizer is the finalizer label added to Azure Resources which need to reaped before K8s deletion 10 | AzureInfraFinalizer = "infra.azure.com/finalizer" 11 | ) 12 | -------------------------------------------------------------------------------- /apis/microsoft.compute/v1/conversion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package v1 7 | 8 | func (*VirtualMachine) Hub() {} 9 | func (*VirtualMachineScaleSet) Hub() {} 10 | -------------------------------------------------------------------------------- /apis/microsoft.compute/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package v1 7 | -------------------------------------------------------------------------------- /apis/microsoft.compute/v1/groupversion_info.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | // Package v1 contains API Schema definitions for the microsoft.compute v1 API group 7 | // +kubebuilder:object:generate=true 8 | // +groupName=microsoft.compute.infra.azure.com 9 | package v1 10 | 11 | import ( 12 | "k8s.io/apimachinery/pkg/runtime/schema" 13 | "sigs.k8s.io/controller-runtime/pkg/scheme" 14 | ) 15 | 16 | var ( 17 | // GroupVersion is group version used to register these objects 18 | GroupVersion = schema.GroupVersion{Group: "microsoft.compute.infra.azure.com", Version: "v1"} 19 | 20 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 21 | SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} 22 | 23 | // AddToScheme adds the types in this group-version to the given scheme. 24 | AddToScheme = SchemeBuilder.AddToScheme 25 | ) 26 | -------------------------------------------------------------------------------- /apis/microsoft.compute/v1/resources.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package v1 7 | 8 | import ( 9 | azcorev1 "github.com/Azure/k8s-infra/apis/core/v1" 10 | ) 11 | 12 | func (vm *VirtualMachine) GetResourceGroupObjectRef() *azcorev1.KnownTypeReference { 13 | return vm.Spec.ResourceGroupRef 14 | } 15 | 16 | func (vmss *VirtualMachineScaleSet) GetResourceGroupObjectRef() *azcorev1.KnownTypeReference { 17 | return vmss.Spec.ResourceGroupRef 18 | } 19 | 20 | func (*VirtualMachine) ResourceType() string { 21 | return "Microsoft.Compute/virtualMachines" 22 | } 23 | 24 | func (*VirtualMachineScaleSet) ResourceType() string { 25 | return "Microsoft.Compute/virtualMachineScaleSets" 26 | } 27 | -------------------------------------------------------------------------------- /apis/microsoft.compute/v20191201/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | // +k8s:conversion-gen=github.com/Azure/k8s-infra/apis/microsoft.compute/v1 7 | package v20191201 8 | -------------------------------------------------------------------------------- /apis/microsoft.compute/v20191201/groupversion_info.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | // Package v20191201 contains API Schema definitions for the microsoft.compute v20191201 API group 7 | // +kubebuilder:object:generate=true 8 | // +groupName=microsoft.compute.infra.azure.com 9 | package v20191201 10 | 11 | import ( 12 | "k8s.io/apimachinery/pkg/runtime/schema" 13 | "sigs.k8s.io/controller-runtime/pkg/scheme" 14 | ) 15 | 16 | var ( 17 | // GroupVersion is group version used to register these objects 18 | GroupVersion = schema.GroupVersion{Group: "microsoft.compute.infra.azure.com", Version: "v20191201"} 19 | 20 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 21 | SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} 22 | 23 | // AddToScheme adds the types in this group-version to the given scheme. 24 | AddToScheme = SchemeBuilder.AddToScheme 25 | 26 | localSchemeBuilder = SchemeBuilder.SchemeBuilder 27 | ) 28 | -------------------------------------------------------------------------------- /apis/microsoft.network/v1/conversion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package v1 7 | 8 | func (*BackendAddressPool) Hub() {} 9 | func (*FrontendIPConfiguration) Hub() {} 10 | func (*InboundNatRule) Hub() {} 11 | func (*LoadBalancer) Hub() {} 12 | func (*LoadBalancingRule) Hub() {} 13 | func (*NetworkSecurityGroup) Hub() {} 14 | func (*OutboundRule) Hub() {} 15 | func (*Route) Hub() {} 16 | func (*RouteTable) Hub() {} 17 | func (*SecurityRule) Hub() {} 18 | func (*VirtualNetwork) Hub() {} 19 | func (*Subnet) Hub() {} 20 | func (*NetworkInterface) Hub() {} 21 | -------------------------------------------------------------------------------- /apis/microsoft.network/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package v1 7 | -------------------------------------------------------------------------------- /apis/microsoft.network/v1/groupversion_info.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | // Package v1 contains API Schema definitions for the microsoftnetwork v1 API group 7 | // +kubebuilder:object:generate=true 8 | // +groupName=microsoft.network.infra.azure.com 9 | package v1 10 | 11 | import ( 12 | "k8s.io/apimachinery/pkg/runtime/schema" 13 | "sigs.k8s.io/controller-runtime/pkg/scheme" 14 | ) 15 | 16 | var ( 17 | // GroupVersion is group version used to register these objects 18 | GroupVersion = schema.GroupVersion{Group: "microsoft.network.infra.azure.com", Version: "v1"} 19 | 20 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 21 | SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} 22 | 23 | // AddToScheme adds the types in this group-version to the given scheme. 24 | AddToScheme = SchemeBuilder.AddToScheme 25 | ) 26 | -------------------------------------------------------------------------------- /apis/microsoft.network/v20191101/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | // +k8s:conversion-gen=github.com/Azure/k8s-infra/apis/microsoft.network/v1 7 | package v20191101 8 | -------------------------------------------------------------------------------- /apis/microsoft.network/v20191101/groupversion_info.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | // Package v20191101 contains API Schema definitions for the microsoftnetwork v20191101 API group 7 | // +kubebuilder:object:generate=true 8 | // +groupName=microsoft.network.infra.azure.com 9 | package v20191101 10 | 11 | import ( 12 | "k8s.io/apimachinery/pkg/runtime/schema" 13 | "sigs.k8s.io/controller-runtime/pkg/scheme" 14 | ) 15 | 16 | var ( 17 | // GroupVersion is group version used to register these objects 18 | GroupVersion = schema.GroupVersion{Group: "microsoft.network.infra.azure.com", Version: "v20191101"} 19 | 20 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 21 | SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} 22 | 23 | // AddToScheme adds the types in this group-version to the given scheme. 24 | AddToScheme = SchemeBuilder.AddToScheme 25 | 26 | localSchemeBuilder = SchemeBuilder.SchemeBuilder 27 | ) 28 | -------------------------------------------------------------------------------- /apis/microsoft.resources/v1/conversion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package v1 7 | 8 | func (*ResourceGroup) Hub() {} 9 | -------------------------------------------------------------------------------- /apis/microsoft.resources/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package v1 7 | -------------------------------------------------------------------------------- /apis/microsoft.resources/v1/groupversion_info.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | // Package v0 contains API Schema definitions for the microsoftresources v0 API group 7 | // +kubebuilder:object:generate=true 8 | // +groupName=microsoft.resources.infra.azure.com 9 | package v1 10 | 11 | import ( 12 | "k8s.io/apimachinery/pkg/runtime/schema" 13 | "sigs.k8s.io/controller-runtime/pkg/scheme" 14 | ) 15 | 16 | var ( 17 | // GroupVersion is group version used to register these objects 18 | GroupVersion = schema.GroupVersion{Group: "microsoft.resources.infra.azure.com", Version: "v1"} 19 | 20 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 21 | SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} 22 | 23 | // AddToScheme adds the types in this group-version to the given scheme. 24 | AddToScheme = SchemeBuilder.AddToScheme 25 | ) 26 | -------------------------------------------------------------------------------- /apis/microsoft.resources/v20150101/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | // +k8s:conversion-gen=github.com/Azure/k8s-infra/apis/microsoft.resources/v1 7 | package v20150101 8 | -------------------------------------------------------------------------------- /apis/microsoft.resources/v20150101/groupversion_info.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | // Package v20150101 contains API Schema definitions for the microsoftresources v20150101 API group 7 | // +kubebuilder:object:generate=true 8 | // +groupName=microsoft.resources.infra.azure.com 9 | package v20150101 10 | 11 | import ( 12 | "k8s.io/apimachinery/pkg/runtime/schema" 13 | "sigs.k8s.io/controller-runtime/pkg/scheme" 14 | ) 15 | 16 | var ( 17 | // GroupVersion is group version used to register these objects 18 | GroupVersion = schema.GroupVersion{Group: "microsoft.resources.infra.azure.com", Version: "v20150101"} 19 | 20 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 21 | SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} 22 | 23 | // AddToScheme adds the types in this group-version to the given scheme. 24 | AddToScheme = SchemeBuilder.AddToScheme 25 | 26 | localSchemeBuilder = SchemeBuilder.SchemeBuilder 27 | ) 28 | -------------------------------------------------------------------------------- /apis/microsoft.resources/v20191001/conversion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package v20191001 7 | 8 | import ( 9 | "sigs.k8s.io/controller-runtime/pkg/conversion" 10 | 11 | v1 "github.com/Azure/k8s-infra/apis/microsoft.resources/v1" 12 | ) 13 | 14 | func (src *ResourceGroup) ConvertTo(dstRaw conversion.Hub) error { 15 | dst := dstRaw.(*v1.ResourceGroup) 16 | 17 | if err := Convert_v20191001_ResourceGroup_To_v1_ResourceGroup(src, dst, nil); err != nil { 18 | return err 19 | } 20 | 21 | dst.Spec.APIVersion = "2019-10-01" 22 | return nil 23 | } 24 | 25 | func (dst *ResourceGroup) ConvertFrom(srcRaw conversion.Hub) error { 26 | src := srcRaw.(*v1.ResourceGroup) 27 | 28 | if err := Convert_v1_ResourceGroup_To_v20191001_ResourceGroup(src, dst, nil); err != nil { 29 | return err 30 | } 31 | 32 | return nil 33 | } 34 | -------------------------------------------------------------------------------- /apis/microsoft.resources/v20191001/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | // +k8s:conversion-gen=github.com/Azure/k8s-infra/apis/microsoft.resources/v1 7 | package v20191001 8 | -------------------------------------------------------------------------------- /apis/microsoft.resources/v20191001/groupversion_info.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | // Package v20191001 contains API Schema definitions for the microsoftresources v20191001 API group 7 | // +kubebuilder:object:generate=true 8 | // +groupName=microsoft.resources.infra.azure.com 9 | package v20191001 10 | 11 | import ( 12 | "k8s.io/apimachinery/pkg/runtime/schema" 13 | "sigs.k8s.io/controller-runtime/pkg/scheme" 14 | ) 15 | 16 | var ( 17 | // GroupVersion is group version used to register these objects 18 | GroupVersion = schema.GroupVersion{Group: "microsoft.resources.infra.azure.com", Version: "v20191001"} 19 | 20 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 21 | SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} 22 | 23 | // AddToScheme adds the types in this group-version to the given scheme. 24 | AddToScheme = SchemeBuilder.AddToScheme 25 | 26 | localSchemeBuilder = SchemeBuilder.SchemeBuilder 27 | ) 28 | -------------------------------------------------------------------------------- /config/certmanager/certificate.yaml: -------------------------------------------------------------------------------- 1 | # The following manifests contain a self-signed issuer CR and a certificate CR. 2 | # More document can be found at https://docs.cert-manager.io 3 | # WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for breaking changes 4 | apiVersion: cert-manager.io/v1alpha2 5 | kind: Issuer 6 | metadata: 7 | name: selfsigned-issuer 8 | namespace: system 9 | spec: 10 | selfSigned: {} 11 | --- 12 | apiVersion: cert-manager.io/v1alpha2 13 | kind: Certificate 14 | metadata: 15 | name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml 16 | namespace: system 17 | spec: 18 | # $(SERVICE_NAME) and $(SERVICE_NAMESPACE) will be substituted by kustomize 19 | dnsNames: 20 | - $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc 21 | - $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc.cluster.local 22 | issuerRef: 23 | kind: Issuer 24 | name: selfsigned-issuer 25 | secretName: webhook-server-cert # this secret will not be prefixed, since it's not managed by kustomize 26 | -------------------------------------------------------------------------------- /config/certmanager/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - certificate.yaml 3 | 4 | configurations: 5 | - kustomizeconfig.yaml 6 | -------------------------------------------------------------------------------- /config/certmanager/kustomizeconfig.yaml: -------------------------------------------------------------------------------- 1 | # This configuration is for teaching kustomize how to update name ref and var substitution 2 | nameReference: 3 | - kind: Issuer 4 | group: cert-manager.io 5 | fieldSpecs: 6 | - kind: Certificate 7 | group: cert-manager.io 8 | path: spec/issuerRef/name 9 | 10 | varReference: 11 | - kind: Certificate 12 | group: cert-manager.io 13 | path: spec/commonName 14 | - kind: Certificate 15 | group: cert-manager.io 16 | path: spec/dnsNames 17 | -------------------------------------------------------------------------------- /config/crd/kustomizeconfig.yaml: -------------------------------------------------------------------------------- 1 | # This file is for teaching kustomize how to substitute name and namespace reference in CRD 2 | nameReference: 3 | - kind: Service 4 | version: v1 5 | fieldSpecs: 6 | - kind: CustomResourceDefinition 7 | group: apiextensions.k8s.io 8 | path: spec/conversion/webhook/clientConfig/service/name 9 | 10 | namespace: 11 | - kind: CustomResourceDefinition 12 | group: apiextensions.k8s.io 13 | path: spec/conversion/webhook/clientConfig/service/namespace 14 | create: false 15 | 16 | varReference: 17 | - path: metadata/annotations 18 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_backendaddresspools.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: backendaddresspools.microsoft.network.infra.azure.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_frontendipconfigurations.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: frontendipconfigurations.microsoft.network.infra.azure.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_inboundnatrules.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: inboundnatrules.microsoft.network.infra.azure.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_loadbalancers.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: loadbalancers.microsoft.network.infra.azure.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_loadbalancingrules.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: loadbalancingrules.microsoft.network.infra.azure.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_networkinterfaces.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: networkinterfaces.microsoft.network.infra.azure.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_networksecuritygroups.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: networksecuritygroups.microsoft.network.infra.azure.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_outboundrules.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: outboundrules.microsoft.network.infra.azure.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_resourcegroups.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: resourcegroups.microsoft.resources.infra.azure.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_routes.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: routes.microsoft.network.infra.azure.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_routetables.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: routetables.microsoft.network.infra.azure.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_securityrules.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: securityrules.microsoft.network.infra.azure.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_subnets.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: subnets.microsoft.network.infra.azure.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_virtualmachines.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: virtualmachines.microsoft.compute.infra.azure.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_virtualmachinescalesets.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: virtualmachinescalesets.microsoft.compute.infra.azure.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_virtualnetworks.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: virtualnetworks.microsoft.network.infra.azure.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_backendaddresspools.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: backendaddresspools.microsoft.network.infra.azure.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 14 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 15 | caBundle: Cg== 16 | service: 17 | namespace: system 18 | name: webhook-service 19 | path: /convert -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_frontendipconfigurations.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: frontendipconfigurations.microsoft.network.infra.azure.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 14 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 15 | caBundle: Cg== 16 | service: 17 | namespace: system 18 | name: webhook-service 19 | path: /convert -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_inboundnatrules.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: inboundnatrules.microsoft.network.infra.azure.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 14 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 15 | caBundle: Cg== 16 | service: 17 | namespace: system 18 | name: webhook-service 19 | path: /convert -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_loadbalancers.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: loadbalancers.microsoft.network.infra.azure.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 14 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 15 | caBundle: Cg== 16 | service: 17 | namespace: system 18 | name: webhook-service 19 | path: /convert -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_loadbalancingrules.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: loadbalancingrules.microsoft.network.infra.azure.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 14 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 15 | caBundle: Cg== 16 | service: 17 | namespace: system 18 | name: webhook-service 19 | path: /convert -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_networkinterfaces.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: networkinterfaces.microsoft.network.infra.azure.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 14 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 15 | caBundle: Cg== 16 | service: 17 | namespace: system 18 | name: webhook-service 19 | path: /convert 20 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_networksecuritygroups.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: networksecuritygroups.microsoft.network.infra.azure.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 14 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 15 | caBundle: Cg== 16 | service: 17 | namespace: system 18 | name: webhook-service 19 | path: /convert -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_outboundrules.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: outboundrules.microsoft.network.infra.azure.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 14 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 15 | caBundle: Cg== 16 | service: 17 | namespace: system 18 | name: webhook-service 19 | path: /convert -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_resourcegroups.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: resourcegroups.microsoft.resources.infra.azure.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 14 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 15 | caBundle: Cg== 16 | service: 17 | namespace: system 18 | name: webhook-service 19 | path: /convert -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_routes.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: routes.microsoft.network.infra.azure.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 14 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 15 | caBundle: Cg== 16 | service: 17 | namespace: system 18 | name: webhook-service 19 | path: /convert -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_routetables.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: routetables.microsoft.network.infra.azure.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 14 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 15 | caBundle: Cg== 16 | service: 17 | namespace: system 18 | name: webhook-service 19 | path: /convert -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_securityrules.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: securityrules.microsoft.network.infra.azure.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 14 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 15 | caBundle: Cg== 16 | service: 17 | namespace: system 18 | name: webhook-service 19 | path: /convert -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_subnets.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: subnets.microsoft.network.infra.azure.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 14 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 15 | caBundle: Cg== 16 | service: 17 | namespace: system 18 | name: webhook-service 19 | path: /convert 20 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_virtualmachines.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: virtualmachines.microsoft.compute.infra.azure.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 14 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 15 | caBundle: Cg== 16 | service: 17 | namespace: system 18 | name: webhook-service 19 | path: /convert 20 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_virtualmachinescalesets.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: virtualmachinescalesets.microsoft.compute.infra.azure.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 14 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 15 | caBundle: Cg== 16 | service: 17 | namespace: system 18 | name: webhook-service 19 | path: /convert 20 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_virtualnetworks.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: virtualnetworks.microsoft.network.infra.azure.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 14 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 15 | caBundle: Cg== 16 | service: 17 | namespace: system 18 | name: webhook-service 19 | path: /convert -------------------------------------------------------------------------------- /config/credentials/credentials.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | name: manager-bootstrap-credentials 5 | namespace: system 6 | type: Opaque 7 | data: 8 | subscription-id: ${AZURE_SUBSCRIPTION_ID_B64} 9 | tenant-id: ${AZURE_TENANT_ID_B64} 10 | client-id: ${AZURE_CLIENT_ID_B64} 11 | client-secret: ${AZURE_CLIENT_SECRET_B64} -------------------------------------------------------------------------------- /config/credentials/kustomization.yaml: -------------------------------------------------------------------------------- 1 | namespace: k8s-infra-system 2 | 3 | bases: 4 | - ../default 5 | 6 | resources: 7 | - credentials.yaml -------------------------------------------------------------------------------- /config/default/manager_credentials_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | - name: manager 11 | env: 12 | - name: AZURE_SUBSCRIPTION_ID 13 | valueFrom: 14 | secretKeyRef: 15 | name: manager-bootstrap-credentials 16 | key: subscription-id 17 | - name: AZURE_TENANT_ID 18 | valueFrom: 19 | secretKeyRef: 20 | name: manager-bootstrap-credentials 21 | key: tenant-id 22 | - name: AZURE_CLIENT_ID 23 | valueFrom: 24 | secretKeyRef: 25 | name: manager-bootstrap-credentials 26 | key: client-id 27 | - name: AZURE_CLIENT_SECRET 28 | valueFrom: 29 | secretKeyRef: 30 | name: manager-bootstrap-credentials 31 | key: client-secret -------------------------------------------------------------------------------- /config/default/manager_webhook_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | - name: manager 11 | ports: 12 | - containerPort: 9443 13 | name: webhook-server 14 | protocol: TCP 15 | volumeMounts: 16 | - mountPath: /tmp/k8s-webhook-server/serving-certs 17 | name: cert 18 | readOnly: true 19 | volumes: 20 | - name: cert 21 | secret: 22 | defaultMode: 420 23 | secretName: webhook-server-cert 24 | -------------------------------------------------------------------------------- /config/default/webhookcainjection_patch.yaml: -------------------------------------------------------------------------------- 1 | ## This patch add annotation to admission webhook config and 2 | ## the variables $(CERTIFICATE_NAMESPACE) and $(CERTIFICATE_NAME) will be substituted by kustomize. 3 | apiVersion: admissionregistration.k8s.io/v1beta1 4 | kind: MutatingWebhookConfiguration 5 | metadata: 6 | name: mutating-webhook-configuration 7 | annotations: 8 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 9 | --- 10 | apiVersion: admissionregistration.k8s.io/v1beta1 11 | kind: ValidatingWebhookConfiguration 12 | metadata: 13 | name: validating-webhook-configuration 14 | annotations: 15 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 16 | -------------------------------------------------------------------------------- /config/manager/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - manager.yaml 3 | 4 | patchesStrategicMerge: 5 | - manager_auth_proxy_patch.yaml 6 | - manager_image_patch.yaml 7 | - manager_pull_policy.yaml 8 | -------------------------------------------------------------------------------- /config/manager/manager.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | labels: 5 | control-plane: controller-manager 6 | name: system 7 | --- 8 | apiVersion: apps/v1 9 | kind: Deployment 10 | metadata: 11 | name: controller-manager 12 | namespace: system 13 | labels: 14 | control-plane: controller-manager 15 | spec: 16 | selector: 17 | matchLabels: 18 | control-plane: controller-manager 19 | replicas: 1 20 | template: 21 | metadata: 22 | labels: 23 | control-plane: controller-manager 24 | spec: 25 | containers: 26 | - command: 27 | - /manager 28 | args: 29 | - --enable-leader-election 30 | image: controller:latest 31 | name: manager 32 | resources: 33 | limits: 34 | cpu: 100m 35 | memory: 30Mi 36 | requests: 37 | cpu: 100m 38 | memory: 20Mi 39 | terminationGracePeriodSeconds: 10 40 | -------------------------------------------------------------------------------- /config/manager/manager_auth_proxy_patch.yaml: -------------------------------------------------------------------------------- 1 | # This patch inject a sidecar container which is a HTTP proxy for the controller manager, 2 | # it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews. 3 | apiVersion: apps/v1 4 | kind: Deployment 5 | metadata: 6 | name: controller-manager 7 | namespace: system 8 | spec: 9 | template: 10 | spec: 11 | containers: 12 | - name: kube-rbac-proxy 13 | image: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1 14 | args: 15 | - "--secure-listen-address=0.0.0.0:8443" 16 | - "--upstream=http://127.0.0.1:8080/" 17 | - "--logtostderr=true" 18 | - "--v=10" 19 | ports: 20 | - containerPort: 8443 21 | name: https 22 | - name: manager 23 | args: 24 | - "--metrics-addr=127.0.0.1:8080" 25 | - "--enable-leader-election" 26 | -------------------------------------------------------------------------------- /config/manager/manager_image_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | # Change the value of image field below to your controller image URL 11 | - image: kind-registry:5000/fake/k8s-infra-controller:latest 12 | name: manager -------------------------------------------------------------------------------- /config/manager/manager_pull_policy.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | - name: manager 11 | imagePullPolicy: Always -------------------------------------------------------------------------------- /config/prometheus/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - monitor.yaml 3 | -------------------------------------------------------------------------------- /config/prometheus/monitor.yaml: -------------------------------------------------------------------------------- 1 | 2 | # Prometheus Monitor Service (Metrics) 3 | apiVersion: monitoring.coreos.com/v1 4 | kind: ServiceMonitor 5 | metadata: 6 | labels: 7 | control-plane: controller-manager 8 | name: controller-manager-metrics-monitor 9 | namespace: system 10 | spec: 11 | endpoints: 12 | - path: /metrics 13 | port: https 14 | selector: 15 | control-plane: controller-manager 16 | -------------------------------------------------------------------------------- /config/rbac/auth_proxy_role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | name: proxy-role 5 | rules: 6 | - apiGroups: ["authentication.k8s.io"] 7 | resources: 8 | - tokenreviews 9 | verbs: ["create"] 10 | - apiGroups: ["authorization.k8s.io"] 11 | resources: 12 | - subjectaccessreviews 13 | verbs: ["create"] 14 | -------------------------------------------------------------------------------- /config/rbac/auth_proxy_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: proxy-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: proxy-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: default 12 | namespace: system 13 | -------------------------------------------------------------------------------- /config/rbac/auth_proxy_service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | control-plane: controller-manager 6 | name: controller-manager-metrics-service 7 | namespace: system 8 | spec: 9 | ports: 10 | - name: https 11 | port: 8443 12 | targetPort: https 13 | selector: 14 | control-plane: controller-manager 15 | -------------------------------------------------------------------------------- /config/rbac/backendaddresspool_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit backendaddresspools. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: backendaddresspool-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - backendaddresspools 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.network.infra.azure.com 21 | resources: 22 | - backendaddresspools/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/backendaddresspool_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view backendaddresspools. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: backendaddresspool-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - backendaddresspools 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.network.infra.azure.com 17 | resources: 18 | - backendaddresspools/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/frontendipconfiguration_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit frontendipconfigurations. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: frontendipconfiguration-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - frontendipconfigurations 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.network.infra.azure.com 21 | resources: 22 | - frontendipconfigurations/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/frontendipconfiguration_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view frontendipconfigurations. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: frontendipconfiguration-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - frontendipconfigurations 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.network.infra.azure.com 17 | resources: 18 | - frontendipconfigurations/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/inboundnatrule_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit inboundnatrules. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: inboundnatrule-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - inboundnatrules 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.network.infra.azure.com 21 | resources: 22 | - inboundnatrules/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/inboundnatrule_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view inboundnatrules. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: inboundnatrule-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - inboundnatrules 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.network.infra.azure.com 17 | resources: 18 | - inboundnatrules/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - role.yaml 3 | - role_binding.yaml 4 | - leader_election_role.yaml 5 | - leader_election_role_binding.yaml 6 | # Comment the following 3 lines if you want to disable 7 | # the auth proxy (https://github.com/brancz/kube-rbac-proxy) 8 | # which protects your /metrics endpoint. 9 | - auth_proxy_service.yaml 10 | - auth_proxy_role.yaml 11 | - auth_proxy_role_binding.yaml 12 | -------------------------------------------------------------------------------- /config/rbac/leader_election_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do leader election. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: Role 4 | metadata: 5 | name: leader-election-role 6 | rules: 7 | - apiGroups: 8 | - "" 9 | resources: 10 | - configmaps 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - create 16 | - update 17 | - patch 18 | - delete 19 | - apiGroups: 20 | - "" 21 | resources: 22 | - configmaps/status 23 | verbs: 24 | - get 25 | - update 26 | - patch 27 | - apiGroups: 28 | - "" 29 | resources: 30 | - events 31 | verbs: 32 | - create 33 | -------------------------------------------------------------------------------- /config/rbac/leader_election_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: RoleBinding 3 | metadata: 4 | name: leader-election-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: Role 8 | name: leader-election-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: default 12 | namespace: system 13 | -------------------------------------------------------------------------------- /config/rbac/loadbalancer_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit loadbalancers. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: loadbalancer-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - loadbalancers 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.network.infra.azure.com 21 | resources: 22 | - loadbalancers/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/loadbalancer_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view loadbalancers. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: loadbalancer-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - loadbalancers 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.network.infra.azure.com 17 | resources: 18 | - loadbalancers/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/loadbalancingrule_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit loadbalancingrules. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: loadbalancingrule-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - loadbalancingrules 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.network.infra.azure.com 21 | resources: 22 | - loadbalancingrules/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/loadbalancingrule_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view loadbalancingrules. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: loadbalancingrule-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - loadbalancingrules 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.network.infra.azure.com 17 | resources: 18 | - loadbalancingrules/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/networkinterface_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit networkinterfaces. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: networkinterface-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - networkinterfaces 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.network.infra.azure.com 21 | resources: 22 | - networkinterfaces/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/networkinterface_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view networkinterfaces. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: networkinterface-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - networkinterfaces 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.network.infra.azure.com 17 | resources: 18 | - networkinterfaces/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/networkinterfaceipconfiguration_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit networkinterfaceipconfigurations. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: networkinterfaceipconfiguration-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - networkinterfaceipconfigurations 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.network.infra.azure.com 21 | resources: 22 | - networkinterfaceipconfigurations/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/networkinterfaceipconfiguration_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view networkinterfaceipconfigurations. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: networkinterfaceipconfiguration-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - networkinterfaceipconfigurations 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.network.infra.azure.com 17 | resources: 18 | - networkinterfaceipconfigurations/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/networksecuritygroup_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit networksecuritygroups. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: networksecuritygroup-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - networksecuritygroups 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.network.infra.azure.com 21 | resources: 22 | - networksecuritygroups/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/networksecuritygroup_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view networksecuritygroups. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: networksecuritygroup-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - networksecuritygroups 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.network.infra.azure.com 17 | resources: 18 | - networksecuritygroups/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/outboundrule_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit outboundrules. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: outboundrule-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - outboundrules 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.network.infra.azure.com 21 | resources: 22 | - outboundrules/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/outboundrule_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view outboundrules. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: outboundrule-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - outboundrules 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.network.infra.azure.com 17 | resources: 18 | - outboundrules/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/resourcegroup_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit resourcegroups. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: resourcegroup-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.resources.infra.azure.com 9 | resources: 10 | - resourcegroups 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.resources.infra.azure.com 21 | resources: 22 | - resourcegroups/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/resourcegroup_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view resourcegroups. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: resourcegroup-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.resources.infra.azure.com 9 | resources: 10 | - resourcegroups 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.resources.infra.azure.com 17 | resources: 18 | - resourcegroups/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: manager-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: manager-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: default 12 | namespace: system 13 | -------------------------------------------------------------------------------- /config/rbac/route_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit routes. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: route-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - routes 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.network.infra.azure.com 21 | resources: 22 | - routes/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/route_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view routes. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: route-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - routes 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.network.infra.azure.com 17 | resources: 18 | - routes/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/routetable_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit routetables. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: routetable-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - routetables 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.network.infra.azure.com 21 | resources: 22 | - routetables/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/routetable_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view routetables. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: routetable-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - routetables 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.network.infra.azure.com 17 | resources: 18 | - routetables/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/securityrule_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit securityrules. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: securityrule-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - securityrules 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.network.infra.azure.com 21 | resources: 22 | - securityrules/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/securityrule_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view securityrules. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: securityrule-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - securityrules 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.network.infra.azure.com 17 | resources: 18 | - securityrules/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/subnet_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit subnets. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: subnet-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - subnets 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.network.infra.azure.com 21 | resources: 22 | - subnets/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/subnet_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view subnets. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: subnet-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - subnets 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.network.infra.azure.com 17 | resources: 18 | - subnets/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/virtualmachine_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit virtualmachines. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualmachine-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.compute.infra.azure.com 9 | resources: 10 | - virtualmachines 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.compute.infra.azure.com 21 | resources: 22 | - virtualmachines/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/virtualmachine_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view virtualmachines. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualmachine-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.compute.infra.azure.com 9 | resources: 10 | - virtualmachines 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.compute.infra.azure.com 17 | resources: 18 | - virtualmachines/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/virtualmachinescaleset_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit virtualmachinescalesets. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualmachinescaleset-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.compute.infra.azure.com 9 | resources: 10 | - virtualmachinescalesets 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.compute.infra.azure.com 21 | resources: 22 | - virtualmachinescalesets/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/virtualmachinescaleset_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view virtualmachinescalesets. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualmachinescaleset-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.compute.infra.azure.com 9 | resources: 10 | - virtualmachinescalesets 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.compute.infra.azure.com 17 | resources: 18 | - virtualmachinescalesets/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/virtualnetwork_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit virtualnetworks. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualnetwork-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - virtualnetworks 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.network.infra.azure.com 21 | resources: 22 | - virtualnetworks/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/virtualnetwork_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view virtualnetworks. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualnetwork-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.network.infra.azure.com 9 | resources: 10 | - virtualnetworks 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.network.infra.azure.com 17 | resources: 18 | - virtualnetworks/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/samples/microsoft.network_v20191101_backendaddresspool.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.network.infra.azure.com/v20191101 2 | kind: BackendAddressPool 3 | metadata: 4 | name: backendaddresspool-sample 5 | spec: 6 | # Add fields here 7 | foo: bar 8 | -------------------------------------------------------------------------------- /config/samples/microsoft.network_v20191101_frontendipconfiguration.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.network.infra.azure.com/v20191101 2 | kind: FrontendIPConfiguration 3 | metadata: 4 | name: frontendipconfiguration-sample 5 | spec: 6 | # Add fields here 7 | foo: bar 8 | -------------------------------------------------------------------------------- /config/samples/microsoft.network_v20191101_inboundnatrule.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.network.infra.azure.com/v20191101 2 | kind: InboundNatRule 3 | metadata: 4 | name: inboundnatrule-sample 5 | spec: 6 | # Add fields here 7 | foo: bar 8 | -------------------------------------------------------------------------------- /config/samples/microsoft.network_v20191101_loadbalancer.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.network.infra.azure.com/v20191101 2 | kind: LoadBalancer 3 | metadata: 4 | name: loadbalancer-sample 5 | spec: 6 | # Add fields here 7 | foo: bar 8 | -------------------------------------------------------------------------------- /config/samples/microsoft.network_v20191101_loadbalancingrule.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.network.infra.azure.com/v20191101 2 | kind: LoadBalancingRule 3 | metadata: 4 | name: loadbalancingrule-sample 5 | spec: 6 | # Add fields here 7 | foo: bar 8 | -------------------------------------------------------------------------------- /config/samples/microsoft.network_v20191101_networkinterface.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.network.infra.azure.com/v20191101 2 | kind: NetworkInterface 3 | metadata: 4 | name: networkinterface-sample 5 | namespace: default 6 | spec: 7 | location: westus2 8 | resourceGroupRef: 9 | name: resourcegroup-sample 10 | namespace: default 11 | properties: 12 | ipConfigurations: 13 | - name: networkinterfaceipconfiguration-1 14 | properties: 15 | subnetRef: 16 | name: subnet-sample 17 | namespace: default -------------------------------------------------------------------------------- /config/samples/microsoft.network_v20191101_networksecuritygroup.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.network.infra.azure.com/v20191101 2 | kind: NetworkSecurityGroup 3 | metadata: 4 | name: networksecuritygroup-sample 5 | spec: 6 | # Add fields here 7 | foo: bar 8 | -------------------------------------------------------------------------------- /config/samples/microsoft.network_v20191101_outboundrule.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.network.infra.azure.com/v20191101 2 | kind: OutboundRule 3 | metadata: 4 | name: outboundrule-sample 5 | spec: 6 | # Add fields here 7 | foo: bar 8 | -------------------------------------------------------------------------------- /config/samples/microsoft.network_v20191101_route.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.network.infra.azure.com/v20191101 2 | kind: Route 3 | metadata: 4 | name: route-sample 5 | spec: 6 | properties: 7 | addressPrefix: 10.0.3.0/24 8 | nextHopType: VnetLocal 9 | 10 | -------------------------------------------------------------------------------- /config/samples/microsoft.network_v20191101_routetable.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.network.infra.azure.com/v20191101 2 | kind: RouteTable 3 | metadata: 4 | name: routetable-sample 5 | namespace: default 6 | spec: 7 | location: westus2 8 | resourceGroupRef: 9 | name: resourcegroup-sample 10 | namespace: default 11 | properties: 12 | disableBgpRoutePropagation: false 13 | routeRefs: 14 | - name: route-sample 15 | namespace: default 16 | -------------------------------------------------------------------------------- /config/samples/microsoft.network_v20191101_securityrule.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.network.infra.azure.com/v20191101 2 | kind: SecurityRule 3 | metadata: 4 | name: securityrule-sample 5 | spec: 6 | # Add fields here 7 | foo: bar 8 | -------------------------------------------------------------------------------- /config/samples/microsoft.network_v20191101_subnet.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.network.infra.azure.com/v20191101 2 | kind: Subnet 3 | metadata: 4 | name: subnet-sample 5 | namespace: default 6 | spec: 7 | properties: 8 | addressPrefix: 10.0.0.0/28 9 | -------------------------------------------------------------------------------- /config/samples/microsoft.network_v20191101_virtualnetwork.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.network.infra.azure.com/v20191101 2 | kind: VirtualNetwork 3 | metadata: 4 | name: vnet-2019 5 | namespace: default 6 | spec: 7 | location: westus2 8 | resourceGroupRef: 9 | name: resourcegroup-sample 10 | namespace: default 11 | properties: 12 | addressSpace: 13 | addressPrefixes: 14 | - 10.0.0.0/16 15 | subnetRefs: 16 | - name: subnet-sample 17 | namespace: default 18 | -------------------------------------------------------------------------------- /config/samples/microsoft.resources_v20150101_resourcegroup.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.resources.infra.azure.com/v20150101 2 | kind: ResourceGroup 3 | metadata: 4 | name: foo-2015 5 | spec: 6 | location: westus2 7 | -------------------------------------------------------------------------------- /config/samples/microsoft.resources_v20191001_resourcegroup.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.resources.infra.azure.com/v20191001 2 | kind: ResourceGroup 3 | metadata: 4 | name: resourcegroup-sample 5 | spec: 6 | location: westus2 7 | -------------------------------------------------------------------------------- /config/webhook/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - manifests.yaml 3 | - service.yaml 4 | 5 | configurations: 6 | - kustomizeconfig.yaml 7 | -------------------------------------------------------------------------------- /config/webhook/kustomizeconfig.yaml: -------------------------------------------------------------------------------- 1 | # the following config is for teaching kustomize where to look at when substituting vars. 2 | # It requires kustomize v2.1.0 or newer to work properly. 3 | nameReference: 4 | - kind: Service 5 | version: v1 6 | fieldSpecs: 7 | - kind: MutatingWebhookConfiguration 8 | group: admissionregistration.k8s.io 9 | path: webhooks/clientConfig/service/name 10 | - kind: ValidatingWebhookConfiguration 11 | group: admissionregistration.k8s.io 12 | path: webhooks/clientConfig/service/name 13 | 14 | namespace: 15 | - kind: MutatingWebhookConfiguration 16 | group: admissionregistration.k8s.io 17 | path: webhooks/clientConfig/service/namespace 18 | create: true 19 | - kind: ValidatingWebhookConfiguration 20 | group: admissionregistration.k8s.io 21 | path: webhooks/clientConfig/service/namespace 22 | create: true 23 | 24 | varReference: 25 | - path: metadata/annotations 26 | -------------------------------------------------------------------------------- /config/webhook/service.yaml: -------------------------------------------------------------------------------- 1 | 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: webhook-service 6 | namespace: system 7 | spec: 8 | ports: 9 | - port: 443 10 | targetPort: 9443 11 | selector: 12 | control-plane: controller-manager 13 | -------------------------------------------------------------------------------- /dev.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | GIT_ROOT=$(git rev-parse --show-toplevel) 6 | TOOL_DEST=$GIT_ROOT/hack/tools 7 | 8 | if [ ! -f "$TOOL_DEST/task" ]; then # check for local installation 9 | if [ ! -f "/usr/local/bin/task" ]; then # or devcontainer installation 10 | $GIT_ROOT/.devcontainer/install-dependencies.sh local # otherwise, install the tools 11 | fi 12 | fi 13 | 14 | export PATH="$TOOL_DEST:$TOOL_DEST/kubebuilder/bin:$PATH" 15 | 16 | echo "Entering $SHELL with expanded PATH (use 'exit' to quit):" 17 | echo "Try running 'task -l' to see possible commands." 18 | $SHELL 19 | -------------------------------------------------------------------------------- /docs/readme.md: -------------------------------------------------------------------------------- 1 | # K8s Infra Docs 2 | 3 | Table of contents for different documentation topics. 4 | 5 | - [Development: getting started developing in k8s-infra](./development.md) 6 | - [Manual Resource Creation](./manual_resource_creation.md) 7 | - [Releasing](./release.md) -------------------------------------------------------------------------------- /docs/release.md: -------------------------------------------------------------------------------- 1 | # Releasing K8s-Infra 2 | Releases should be done often and with as little effort as possible. 3 | 4 | ## Releasing 5 | ```bash 6 | git tag "${version}" # v0.1.0 7 | git push origin "${version} 8 | ``` 9 | 10 | The rest should be done via the GitHub, or other, release workflow. -------------------------------------------------------------------------------- /hack/Makefile: -------------------------------------------------------------------------------- 1 | SHELL = /bin/bash 2 | 3 | V = 0 4 | Q = $(if $(filter 1,$V),,@) 5 | 6 | .PHONY: all 7 | all: 8 | $(Q) cd generator && make all 9 | $(Q) cd generated && make all 10 | 11 | 12 | # This is a separate target to avoid slow test runs when doing local development unless 13 | # you opt in 14 | .PHONY: test-int 15 | test-int: 16 | $(Q) cd generated && make test-int 17 | -------------------------------------------------------------------------------- /hack/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ -------------------------------------------------------------------------------- /hack/crossplane/.gitignore: -------------------------------------------------------------------------------- 1 | _apis 2 | config/ 3 | -------------------------------------------------------------------------------- /hack/crossplane/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/Azure/k8s-infra/hack/crossplane 2 | 3 | go 1.14 4 | 5 | require ( 6 | github.com/crossplane/crossplane-runtime v0.11.0 7 | k8s.io/apimachinery v0.19.2 8 | sigs.k8s.io/controller-runtime v0.6.3 9 | ) 10 | -------------------------------------------------------------------------------- /hack/generated/.gitignore: -------------------------------------------------------------------------------- 1 | apis/ 2 | _apis/ 3 | config/crd/bases/ 4 | config/crd/kustomization.yaml 5 | config/webhook 6 | config/rbac/role.yaml 7 | controllers/controller_resources_gen.go 8 | -------------------------------------------------------------------------------- /hack/generated/config/manager/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - manager.yaml 3 | 4 | patchesStrategicMerge: 5 | - manager_auth_proxy_patch.yaml 6 | - manager_image_patch.yaml 7 | - manager_pull_policy.yaml 8 | -------------------------------------------------------------------------------- /hack/generated/config/manager/manager.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | labels: 5 | control-plane: controller-manager 6 | name: system 7 | --- 8 | apiVersion: apps/v1 9 | kind: Deployment 10 | metadata: 11 | name: controller-manager 12 | namespace: system 13 | labels: 14 | control-plane: controller-manager 15 | spec: 16 | selector: 17 | matchLabels: 18 | control-plane: controller-manager 19 | replicas: 1 20 | template: 21 | metadata: 22 | labels: 23 | control-plane: controller-manager 24 | spec: 25 | containers: 26 | - # command: 27 | # - /manager 28 | args: 29 | - --enable-leader-election 30 | image: controller:latest 31 | name: manager 32 | resources: 33 | limits: 34 | cpu: 500m 35 | memory: 512Mi 36 | requests: 37 | cpu: 200m 38 | memory: 256Mi 39 | terminationGracePeriodSeconds: 10 40 | -------------------------------------------------------------------------------- /hack/generated/config/manager/manager_auth_proxy_patch.yaml: -------------------------------------------------------------------------------- 1 | # This patch inject a sidecar container which is a HTTP proxy for the controller manager, 2 | # it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews. 3 | apiVersion: apps/v1 4 | kind: Deployment 5 | metadata: 6 | name: controller-manager 7 | namespace: system 8 | spec: 9 | template: 10 | spec: 11 | containers: 12 | - name: kube-rbac-proxy 13 | image: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1 14 | args: 15 | - "--secure-listen-address=0.0.0.0:8443" 16 | - "--upstream=http://127.0.0.1:8080/" 17 | - "--logtostderr=true" 18 | - "--v=10" 19 | ports: 20 | - containerPort: 8443 21 | name: https 22 | - name: manager 23 | args: 24 | - "--metrics-addr=127.0.0.1:8080" 25 | - "--enable-leader-election" 26 | -------------------------------------------------------------------------------- /hack/generated/config/manager/manager_pull_policy.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | - name: manager 11 | imagePullPolicy: Always 12 | -------------------------------------------------------------------------------- /hack/generated/config/rbac/auth_proxy_role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | name: proxy-role 5 | rules: 6 | - apiGroups: ["authentication.k8s.io"] 7 | resources: 8 | - tokenreviews 9 | verbs: ["create"] 10 | - apiGroups: ["authorization.k8s.io"] 11 | resources: 12 | - subjectaccessreviews 13 | verbs: ["create"] 14 | -------------------------------------------------------------------------------- /hack/generated/config/rbac/auth_proxy_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: proxy-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: proxy-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: default 12 | namespace: system 13 | -------------------------------------------------------------------------------- /hack/generated/config/rbac/auth_proxy_service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | control-plane: controller-manager 6 | name: controller-manager-metrics-service 7 | namespace: system 8 | spec: 9 | ports: 10 | - name: https 11 | port: 8443 12 | targetPort: https 13 | selector: 14 | control-plane: controller-manager 15 | -------------------------------------------------------------------------------- /hack/generated/config/rbac/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - role.yaml 3 | - role_binding.yaml 4 | - leader_election_role.yaml 5 | - leader_election_role_binding.yaml 6 | # Comment the following 3 lines if you want to disable 7 | # the auth proxy (https://github.com/brancz/kube-rbac-proxy) 8 | # which protects your /metrics endpoint. 9 | - auth_proxy_service.yaml 10 | - auth_proxy_role.yaml 11 | - auth_proxy_role_binding.yaml 12 | -------------------------------------------------------------------------------- /hack/generated/config/rbac/leader_election_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do leader election. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: Role 4 | metadata: 5 | name: leader-election-role 6 | rules: 7 | - apiGroups: 8 | - "" 9 | resources: 10 | - configmaps 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - create 16 | - update 17 | - patch 18 | - delete 19 | - apiGroups: 20 | - "" 21 | resources: 22 | - configmaps/status 23 | verbs: 24 | - get 25 | - update 26 | - patch 27 | - apiGroups: 28 | - "" 29 | resources: 30 | - events 31 | verbs: 32 | - create 33 | -------------------------------------------------------------------------------- /hack/generated/config/rbac/leader_election_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: RoleBinding 3 | metadata: 4 | name: leader-election-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: Role 8 | name: leader-election-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: default 12 | namespace: system 13 | -------------------------------------------------------------------------------- /hack/generated/config/rbac/resourcegroup_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit resourcegroups. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: resourcegroup-editor-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.resources.infra.azure.com 9 | resources: 10 | - resourcegroups 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - microsoft.resources.infra.azure.com 21 | resources: 22 | - resourcegroups/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /hack/generated/config/rbac/resourcegroup_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view resourcegroups. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: resourcegroup-viewer-role 6 | rules: 7 | - apiGroups: 8 | - microsoft.resources.infra.azure.com 9 | resources: 10 | - resourcegroups 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - microsoft.resources.infra.azure.com 17 | resources: 18 | - resourcegroups/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /hack/generated/config/rbac/role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: manager-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: manager-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: default 12 | namespace: system 13 | -------------------------------------------------------------------------------- /hack/generated/config/samples/microsoft.batch_v1alpha1api20170901_batchaccount.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.batch.infra.azure.com/v1alpha1api20170901 2 | kind: BatchAccount 3 | metadata: 4 | name: samplekubebatch 5 | namespace: default 6 | spec: 7 | apiVersion: 2017-09-01 8 | location: westcentralus 9 | owner: 10 | name: k8sinfra-sample-rg 11 | properties: {} # TODO: This is awkward 12 | -------------------------------------------------------------------------------- /hack/generated/config/samples/microsoft.batch_v1alpha1api20170901_batchaccountpool.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.batch.infra.azure.com/v1alpha1api20170901 2 | kind: BatchAccountsPool 3 | metadata: 4 | name: samplekubebatchpool 5 | namespace: default 6 | spec: 7 | apiVersion: 2017-09-01 8 | owner: 9 | name: samplekubebatch 10 | properties: 11 | deploymentConfiguration: 12 | virtualMachineConfiguration: 13 | imageReference: 14 | publisher: canonical 15 | offer: ubuntuserver 16 | sku: 18.04-lts 17 | nodeAgentSkuId: batch.node.ubuntu 18.04 18 | scaleSettings: 19 | fixedScale: 20 | targetDedicatedNodes: 0 21 | vmSize: STANDARD_D1_V2 22 | -------------------------------------------------------------------------------- /hack/generated/config/samples/microsoft.resources_v1alpha1api20200601_resourcegroup.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.resources.infra.azure.com/v1alpha1api20200601 2 | kind: ResourceGroup 3 | metadata: 4 | name: k8sinfra-sample-rg 5 | namespace: default 6 | spec: 7 | location: westcentralus 8 | -------------------------------------------------------------------------------- /hack/generated/config/samples/microsoft.storage_v1alpha1api20190401_storageaccount.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: microsoft.storage.infra.azure.com/v1alpha1api20190401 2 | kind: StorageAccount 3 | metadata: 4 | name: samplekubestorage 5 | namespace: default 6 | spec: 7 | apiVersion: 2019-04-01 8 | location: westcentralus 9 | kind: BlobStorage 10 | sku: 11 | name: Standard_LRS 12 | owner: 13 | name: k8sinfra-sample-rg 14 | properties: 15 | accessTier: Hot 16 | # supportsHttpsTrafficOnly: true 17 | -------------------------------------------------------------------------------- /hack/generated/controllers/controller_resources.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package controllers 7 | 8 | import ( 9 | "k8s.io/apimachinery/pkg/runtime" 10 | 11 | resources "github.com/Azure/k8s-infra/hack/generated/_apis/microsoft.resources/v1alpha1api20200601" 12 | ) 13 | 14 | func GetKnownStorageTypes() []runtime.Object { 15 | knownTypes := getKnownStorageTypes() 16 | 17 | knownTypes = append(knownTypes, new(resources.ResourceGroup)) 18 | 19 | return knownTypes 20 | } 21 | 22 | func GetKnownTypes() []runtime.Object { 23 | knownTypes := getKnownTypes() 24 | 25 | knownTypes = append(knownTypes, new(resources.ResourceGroup)) 26 | 27 | return knownTypes 28 | } 29 | 30 | func CreateScheme() *runtime.Scheme { 31 | scheme := createScheme() 32 | _ = resources.AddToScheme(scheme) 33 | 34 | return scheme 35 | } 36 | -------------------------------------------------------------------------------- /hack/generated/controllers/helpers.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package controllers 7 | 8 | import ( 9 | "fmt" 10 | "time" 11 | 12 | "github.com/google/uuid" 13 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 14 | ) 15 | 16 | // createDeploymentName generates a unique deployment name 17 | func createDeploymentName(_ metav1.Object) (string, error) { 18 | // no status yet, so start provisioning 19 | deploymentUUID, err := uuid.NewUUID() 20 | if err != nil { 21 | return "", err 22 | } 23 | 24 | deploymentName := fmt.Sprintf("%s_%d_%s", "k8s", time.Now().Unix(), deploymentUUID.String()) 25 | return deploymentName, nil 26 | } 27 | -------------------------------------------------------------------------------- /hack/generated/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/Azure/k8s-infra/hack/generated 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/Azure/go-autorest/autorest v0.10.2 7 | github.com/Azure/go-autorest/autorest/azure/auth v0.4.2 8 | github.com/Azure/go-autorest/autorest/date v0.2.0 9 | github.com/Azure/k8s-infra v0.2.0 10 | github.com/devigned/tab v0.1.1 11 | github.com/dnaeon/go-vcr v1.1.0 12 | github.com/go-logr/logr v0.1.0 13 | github.com/google/go-cmp v0.4.0 14 | github.com/google/uuid v1.1.1 15 | github.com/kr/pretty v0.2.0 16 | github.com/kylelemons/godebug v1.1.0 17 | github.com/leanovate/gopter v0.2.8 18 | github.com/onsi/gomega v1.10.1 19 | github.com/pkg/errors v0.9.1 20 | k8s.io/api v0.18.6 21 | k8s.io/apiextensions-apiserver v0.18.6 22 | k8s.io/apimachinery v0.18.6 23 | k8s.io/client-go v0.18.6 24 | k8s.io/klog/v2 v2.0.0 25 | sigs.k8s.io/controller-runtime v0.6.2 26 | ) 27 | -------------------------------------------------------------------------------- /hack/generated/pkg/genruntime/locatable_resource.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package genruntime 7 | 8 | // TODO: The generated types should impl this 9 | type LocatableResource interface { 10 | Location() string 11 | } 12 | -------------------------------------------------------------------------------- /hack/generated/pkg/testcommon/arm_matcher.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package testcommon 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/onsi/gomega/types" 12 | 13 | "github.com/Azure/k8s-infra/hack/generated/pkg/armclient" 14 | ) 15 | 16 | type ArmMatcher struct { 17 | client armclient.Applier 18 | } 19 | 20 | func NewArmMatcher(armClient armclient.Applier) *ArmMatcher { 21 | return &ArmMatcher{ 22 | client: armClient, 23 | } 24 | } 25 | 26 | func (m *ArmMatcher) BeProvisioned(ctx context.Context) types.GomegaMatcher { 27 | return &AzureBeProvisionedMatcher{ 28 | azureClient: m.client, 29 | ctx: ctx, 30 | } 31 | } 32 | 33 | func (m *ArmMatcher) BeDeleted(ctx context.Context) types.GomegaMatcher { 34 | return &AzureBeDeletedMatcher{ 35 | azureClient: m.client, 36 | ctx: ctx, 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /hack/generated/pkg/testcommon/kube_matcher.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package testcommon 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/onsi/gomega/types" 12 | ) 13 | 14 | // TODO: Would we rather these just be on testcontext? Might read better 15 | type KubeMatcher struct { 16 | ensure *Ensure 17 | } 18 | 19 | func NewKubeMatcher(ensure *Ensure) *KubeMatcher { 20 | return &KubeMatcher{ 21 | ensure: ensure, 22 | } 23 | } 24 | 25 | func (m *KubeMatcher) BeProvisioned(ctx context.Context) types.GomegaMatcher { 26 | return &BeProvisionedMatcher{ 27 | ensure: m.ensure, 28 | ctx: ctx, 29 | } 30 | } 31 | 32 | func (m *KubeMatcher) BeDeleted(ctx context.Context) types.GomegaMatcher { 33 | return &BeDeletedMatcher{ 34 | ensure: m.ensure, 35 | ctx: ctx, 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /hack/generated/pkg/testcommon/kube_test_context_real.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package testcommon 7 | 8 | import ( 9 | "github.com/pkg/errors" 10 | ctrl "sigs.k8s.io/controller-runtime" 11 | ) 12 | 13 | func createRealKubeContext(perTestContext PerTestContext) (*KubeBaseTestContext, error) { 14 | config, err := ctrl.GetConfig() 15 | if err != nil { 16 | return nil, errors.Wrapf(err, "unable to retrieve kubeconfig") 17 | } 18 | 19 | return &KubeBaseTestContext{ 20 | PerTestContext: perTestContext, 21 | KubeConfig: config, 22 | }, nil 23 | } 24 | -------------------------------------------------------------------------------- /hack/generator/azure-stack.yaml: -------------------------------------------------------------------------------- 1 | schemaUrl: https://schema.management.azure.com/schemas/2019-03-01-hybrid/deploymentTemplate.json 2 | exportFilters: 3 | - action: include 4 | version: 2020-* 5 | because: all 2020 API versions are included 6 | - action: exclude 7 | version: '*preview' 8 | because: preview SDK versions are excluded by default 9 | -------------------------------------------------------------------------------- /hack/generator/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package main 7 | 8 | import ( 9 | goflag "flag" 10 | "os" 11 | 12 | flag "github.com/spf13/pflag" 13 | "k8s.io/klog/v2" 14 | 15 | "github.com/Azure/k8s-infra/hack/generator/cmd" 16 | ) 17 | 18 | func main() { 19 | flagSet := goflag.NewFlagSet(os.Args[0], goflag.ExitOnError) 20 | klog.InitFlags(flagSet) 21 | flagSet.Parse(os.Args[1:]) //nolint:errcheck // error will never be returned due to ExitOnError 22 | flag.CommandLine.AddGoFlagSet(flagSet) 23 | cmd.Execute() 24 | } 25 | -------------------------------------------------------------------------------- /hack/generator/pkg/astbuilder/literals_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package astbuilder 7 | 8 | import ( 9 | . "github.com/onsi/gomega" 10 | "testing" 11 | ) 12 | 13 | func Test_LiteralString(t *testing.T) { 14 | cases := []struct { 15 | name string 16 | original string 17 | expected string 18 | }{ 19 | {"a word", "foo", "\"foo\""}, 20 | {"multiple words", "foo bar baz", "\"foo bar baz\""}, 21 | {"existing quotes escaped", "foo \"bar\" baz", "\"foo \\\"bar\\\" baz\""}, 22 | {"existing slashes escaped", "this/or/that this\\or\\that", "\"this/or/that this\\\\or\\\\that\""}, 23 | } 24 | 25 | for _, c := range cases { 26 | c := c 27 | 28 | t.Run(c.name, func(t *testing.T) { 29 | t.Parallel() 30 | g := NewGomegaWithT(t) 31 | 32 | literal := StringLiteral(c.original) 33 | 34 | g.Expect(literal.Value).To(Equal(c.expected)) 35 | }) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/arm_type_helpers.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package astmodel 7 | 8 | // CreateARMTypeName creates an ARM object type name 9 | func CreateARMTypeName(name TypeName) TypeName { 10 | return MakeTypeName(name.PackageReference, name.Name()+"ARM") 11 | } 12 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/enum_value.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package astmodel 7 | 8 | // EnumValue captures a single value of the enumeration 9 | type EnumValue struct { 10 | // Identifier is a Go identifier for the value 11 | Identifier string 12 | // Value is the actual value expected by ARM 13 | Value string 14 | } 15 | 16 | // Equals tests to see if the passed EnumValue has the same name and value 17 | func (value *EnumValue) Equals(v *EnumValue) bool { 18 | if value == v { 19 | return true 20 | } 21 | 22 | return value.Identifier == v.Identifier && value.Value == v.Value 23 | } 24 | 25 | // String implements fmt.Stringer for debugging purposes 26 | func (value *EnumValue) String() string { 27 | return value.Identifier 28 | } 29 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/errored_type_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package astmodel 7 | 8 | import ( 9 | "testing" 10 | 11 | "github.com/leanovate/gopter" 12 | "github.com/leanovate/gopter/gen" 13 | "github.com/leanovate/gopter/prop" 14 | ) 15 | 16 | func TestErroredTypeProperties(t *testing.T) { 17 | g := gopter.NewProperties(nil) 18 | 19 | g.Property("wrapping an ErroredType with another merges its errors and warnings", 20 | prop.ForAll( 21 | func(e1 []string, e2 []string, w1 []string, w2 []string) bool { 22 | t := NewErroredType(NewErroredType(StringType, e1, w1), e2, w2) 23 | 24 | return stringSlicesEqual(t.errors, append(e2, e1...)) && 25 | stringSlicesEqual(t.warnings, append(w2, w1...)) && 26 | t.inner == StringType 27 | }, 28 | gen.SliceOf(gen.AnyString()), 29 | gen.SliceOf(gen.AnyString()), 30 | gen.SliceOf(gen.AnyString()), 31 | gen.SliceOf(gen.AnyString()))) 32 | 33 | g.TestingRun(t) 34 | } 35 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/function.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package astmodel 7 | 8 | import ( 9 | "github.com/dave/dst" 10 | ) 11 | 12 | // Function represents something that is an (unnamed) Go function 13 | type Function interface { 14 | // The unique name of this function 15 | // (You can't have two functions with the same name on the same object or resource) 16 | Name() string 17 | 18 | RequiredPackageReferences() *PackageReferenceSet 19 | 20 | // References returns the set of types to which this function refers. 21 | // Should *not* include the receiver of this function 22 | References() TypeNameSet 23 | 24 | // AsFunc renders the current instance as a Go abstract syntax tree 25 | AsFunc(codeGenerationContext *CodeGenerationContext, receiver TypeName) *dst.FuncDecl 26 | 27 | // Equals determines if this Function is equal to another one 28 | Equals(f Function) bool 29 | } 30 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/function_container.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package astmodel 7 | 8 | // FunctionContainer is implemented by Types that contain functions 9 | // Can't include the withers for modification until we have generics 10 | type FunctionContainer interface { 11 | // Functions returns all the function implementations 12 | // A sorted slice is returned to preserve immutability and provide determinism 13 | Functions() []Function 14 | } 15 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/generation_consts.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package astmodel 7 | 8 | var ( 9 | CodeGenerationComments []string = []string{ 10 | // Note that this format is actually an official specification in go: https://github.com/golang/go/issues/13560 11 | "// Code generated by k8s-infra. DO NOT EDIT.", // TODO: Update this when the generated is moved/renamed 12 | } 13 | ) 14 | 15 | const ( 16 | // Suffix used to identify generated files (note there is no file extension here) 17 | CodeGeneratedFileSuffix = "_gen" 18 | ) 19 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/interface_implementer_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package astmodel 7 | 8 | import ( 9 | "testing" 10 | 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func makeInterfaceImplForTest() *InterfaceImplementation { 15 | pr := makeTestLocalPackageReference("group", "package") 16 | 17 | return NewInterfaceImplementation(MakeTypeName(pr, "foo")) 18 | } 19 | 20 | func Test_InterfaceImplementerWithInterface_ReturnsNewInstance(t *testing.T) { 21 | 22 | g := NewGomegaWithT(t) 23 | 24 | original := InterfaceImplementer{} 25 | updated := original.WithInterface(makeInterfaceImplForTest()) 26 | 27 | g.Expect(updated).ToNot(Equal(original)) 28 | g.Expect(len(updated.interfaces)).To(Equal(1)) 29 | } 30 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/json_type.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package astmodel 7 | 8 | var ( 9 | // APIExtensionsPackage contains the type we use to represent 10 | // arbitrary JSON fields. 11 | APIExtensionsPackage = MakeExternalPackageReference("k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1") 12 | 13 | // JSONType is used for fields that need to store arbitrary JSON 14 | // structures. 15 | JSONType = MakeTypeName(APIExtensionsPackage, "JSON") 16 | ) 17 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/kubebuilder_validations_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package astmodel 7 | 8 | import ( 9 | "testing" 10 | 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func Test_ValidateRequired(t *testing.T) { 15 | g := NewGomegaWithT(t) 16 | 17 | validation := ValidateRequired() 18 | comment := GenerateKubebuilderComment(validation) 19 | 20 | g.Expect(comment).To(Equal("// +kubebuilder:validation:Required")) 21 | } 22 | 23 | func Test_ValidateEnum(t *testing.T) { 24 | g := NewGomegaWithT(t) 25 | 26 | validation := ValidateEnum([]interface{}{1, true, "hello"}) 27 | comment := GenerateKubebuilderComment(validation) 28 | 29 | g.Expect(comment).To(Equal("// +kubebuilder:validation:Enum={1,true,hello}")) 30 | } 31 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/property_container.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package astmodel 7 | 8 | // PropertyContainer is implemented by Types that contain properties 9 | // Can't include the withers for modification until we have generics 10 | type PropertyContainer interface { 11 | // Properties returns all the properties from this container 12 | // A sorted slice is returned to preserve immutability and provide determinism 13 | Properties() []*PropertyDefinition 14 | } 15 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/test_case_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package astmodel 7 | 8 | import ( 9 | "github.com/dave/dst" 10 | ) 11 | 12 | type FakeTestCase struct { 13 | name string 14 | } 15 | 16 | var _ TestCase = &FakeTestCase{} 17 | 18 | func NewFakeTestCase(name string) *FakeTestCase { 19 | return &FakeTestCase{ 20 | name: name, 21 | } 22 | } 23 | 24 | func (f FakeTestCase) Name() string { 25 | return f.name 26 | } 27 | 28 | func (f FakeTestCase) References() TypeNameSet { 29 | panic("implement me") 30 | } 31 | 32 | func (f FakeTestCase) RequiredImports() *PackageImportSet { 33 | panic("implement me") 34 | } 35 | 36 | func (f FakeTestCase) AsFuncs(subject TypeName, codeGenerationContext *CodeGenerationContext) []dst.Decl { 37 | panic("implement me") 38 | } 39 | 40 | func (f FakeTestCase) Equals(tc TestCase) bool { 41 | other, ok := tc.(*FakeTestCase) 42 | if !ok { 43 | return false 44 | } 45 | 46 | return f.name == other.name 47 | } 48 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/testdata/ConvertBetweenAliasAndAliasType.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package vCurrent 5 | 6 | import "github.com/Azure/k8s-infra/hack/generated/_apis/Verification/vNext" 7 | 8 | type Person struct { 9 | age Age `json:"age"` 10 | } 11 | 12 | // ConvertFromVNext populates our Person from the provided source Person 13 | func (person Person) ConvertFromVNext(source *vNext.Person) error { 14 | 15 | // age 16 | person.age = Age(source.age) 17 | 18 | // No error 19 | return nil 20 | } 21 | 22 | // ConvertToVNext populates the provided destination Person from our Person 23 | func (person Person) ConvertToVNext(destination *vNext.Person) error { 24 | 25 | // age 26 | destination.age = vNext.Age(person.age) 27 | 28 | // No error 29 | return nil 30 | } 31 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/testdata/ConvertBetweenAliasAndBaseType.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package vCurrent 5 | 6 | import "github.com/Azure/k8s-infra/hack/generated/_apis/Verification/vNext" 7 | 8 | type Person struct { 9 | age Age `json:"age"` 10 | } 11 | 12 | // ConvertFromVNext populates our Person from the provided source Person 13 | func (person Person) ConvertFromVNext(source *vNext.Person) error { 14 | 15 | // age 16 | person.age = Age(source.age) 17 | 18 | // No error 19 | return nil 20 | } 21 | 22 | // ConvertToVNext populates the provided destination Person from our Person 23 | func (person Person) ConvertToVNext(destination *vNext.Person) error { 24 | 25 | // age 26 | destination.age = int(person.age) 27 | 28 | // No error 29 | return nil 30 | } 31 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/testdata/ConvertBetweenAliasAndOptionalAliasType.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package vCurrent 5 | 6 | import "github.com/Azure/k8s-infra/hack/generated/_apis/Verification/vNext" 7 | 8 | type Person struct { 9 | age Age `json:"age"` 10 | } 11 | 12 | // ConvertFromVNext populates our Person from the provided source Person 13 | func (person Person) ConvertFromVNext(source *vNext.Person) error { 14 | 15 | // age 16 | if source.age != nil { 17 | person.age = Age(*source.age) 18 | } else { 19 | person.age = 0 20 | } 21 | 22 | // No error 23 | return nil 24 | } 25 | 26 | // ConvertToVNext populates the provided destination Person from our Person 27 | func (person Person) ConvertToVNext(destination *vNext.Person) error { 28 | 29 | // age 30 | age := vNext.Age(person.age) 31 | destination.age = &age 32 | 33 | // No error 34 | return nil 35 | } 36 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/testdata/ConvertBetweenEnumAndBaseType.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package vCurrent 5 | 6 | import "github.com/Azure/k8s-infra/hack/generated/_apis/Verification/vNext" 7 | 8 | type Person struct { 9 | sku string `json:"sku"` 10 | } 11 | 12 | // ConvertFromVNext populates our Person from the provided source Person 13 | func (person Person) ConvertFromVNext(source *vNext.Person) error { 14 | 15 | // sku 16 | person.sku = string(source.sku) 17 | 18 | // No error 19 | return nil 20 | } 21 | 22 | // ConvertToVNext populates the provided destination Person from our Person 23 | func (person Person) ConvertToVNext(destination *vNext.Person) error { 24 | 25 | // sku 26 | destination.sku = vNext.Bucket(person.sku) 27 | 28 | // No error 29 | return nil 30 | } 31 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/testdata/ConvertBetweenEnumAndOptionalBaseType.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package vCurrent 5 | 6 | import "github.com/Azure/k8s-infra/hack/generated/_apis/Verification/vNext" 7 | 8 | type Person struct { 9 | sku *string `json:"sku"` 10 | } 11 | 12 | // ConvertFromVNext populates our Person from the provided source Person 13 | func (person Person) ConvertFromVNext(source *vNext.Person) error { 14 | 15 | // sku 16 | sku := string(source.sku) 17 | person.sku = &sku 18 | 19 | // No error 20 | return nil 21 | } 22 | 23 | // ConvertToVNext populates the provided destination Person from our Person 24 | func (person Person) ConvertToVNext(destination *vNext.Person) error { 25 | 26 | // sku 27 | if person.sku != nil { 28 | destination.sku = vNext.Bucket(*person.sku) 29 | } else { 30 | destination.sku = "" 31 | } 32 | 33 | // No error 34 | return nil 35 | } 36 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/testdata/ConvertBetweenOptionalAliasAndBaseType.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package vCurrent 5 | 6 | import "github.com/Azure/k8s-infra/hack/generated/_apis/Verification/vNext" 7 | 8 | type Person struct { 9 | age *Age `json:"age"` 10 | } 11 | 12 | // ConvertFromVNext populates our Person from the provided source Person 13 | func (person Person) ConvertFromVNext(source *vNext.Person) error { 14 | 15 | // age 16 | age := Age(source.age) 17 | person.age = &age 18 | 19 | // No error 20 | return nil 21 | } 22 | 23 | // ConvertToVNext populates the provided destination Person from our Person 24 | func (person Person) ConvertToVNext(destination *vNext.Person) error { 25 | 26 | // age 27 | if person.age != nil { 28 | destination.age = int(*person.age) 29 | } else { 30 | destination.age = 0 31 | } 32 | 33 | // No error 34 | return nil 35 | } 36 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/testdata/ConvertBetweenOptionalAliasAndOptionalAliasType.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package vCurrent 5 | 6 | import "github.com/Azure/k8s-infra/hack/generated/_apis/Verification/vNext" 7 | 8 | type Person struct { 9 | age *Age `json:"age"` 10 | } 11 | 12 | // ConvertFromVNext populates our Person from the provided source Person 13 | func (person Person) ConvertFromVNext(source *vNext.Person) error { 14 | 15 | // age 16 | if source.age != nil { 17 | age := Age(*source.age) 18 | person.age = &age 19 | } else { 20 | person.age = nil 21 | } 22 | 23 | // No error 24 | return nil 25 | } 26 | 27 | // ConvertToVNext populates the provided destination Person from our Person 28 | func (person Person) ConvertToVNext(destination *vNext.Person) error { 29 | 30 | // age 31 | if person.age != nil { 32 | age := vNext.Age(*person.age) 33 | destination.age = &age 34 | } else { 35 | destination.age = nil 36 | } 37 | 38 | // No error 39 | return nil 40 | } 41 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/testdata/ConvertBetweenOptionalAliasAndOptionalBaseType.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package vCurrent 5 | 6 | import "github.com/Azure/k8s-infra/hack/generated/_apis/Verification/vNext" 7 | 8 | type Person struct { 9 | age *Age `json:"age"` 10 | } 11 | 12 | // ConvertFromVNext populates our Person from the provided source Person 13 | func (person Person) ConvertFromVNext(source *vNext.Person) error { 14 | 15 | // age 16 | if source.age != nil { 17 | age := Age(*source.age) 18 | person.age = &age 19 | } else { 20 | person.age = nil 21 | } 22 | 23 | // No error 24 | return nil 25 | } 26 | 27 | // ConvertToVNext populates the provided destination Person from our Person 28 | func (person Person) ConvertToVNext(destination *vNext.Person) error { 29 | 30 | // age 31 | if person.age != nil { 32 | age := int(*person.age) 33 | destination.age = &age 34 | } else { 35 | destination.age = nil 36 | } 37 | 38 | // No error 39 | return nil 40 | } 41 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/testdata/ConvertBetweenOptionalEnumAndBaseType.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package vCurrent 5 | 6 | import "github.com/Azure/k8s-infra/hack/generated/_apis/Verification/vNext" 7 | 8 | type Person struct { 9 | sku string `json:"sku"` 10 | } 11 | 12 | // ConvertFromVNext populates our Person from the provided source Person 13 | func (person Person) ConvertFromVNext(source *vNext.Person) error { 14 | 15 | // sku 16 | if source.sku != nil { 17 | person.sku = string(*source.sku) 18 | } else { 19 | person.sku = "" 20 | } 21 | 22 | // No error 23 | return nil 24 | } 25 | 26 | // ConvertToVNext populates the provided destination Person from our Person 27 | func (person Person) ConvertToVNext(destination *vNext.Person) error { 28 | 29 | // sku 30 | sku := vNext.Bucket(person.sku) 31 | destination.sku = &sku 32 | 33 | // No error 34 | return nil 35 | } 36 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/testdata/ConvertBetweenRequiredEnumAndOptionalEnum.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package vCurrent 5 | 6 | import "github.com/Azure/k8s-infra/hack/generated/_apis/Verification/vNext" 7 | 8 | type Person struct { 9 | release Bucket `json:"release"` 10 | } 11 | 12 | // ConvertFromVNext populates our Person from the provided source Person 13 | func (person Person) ConvertFromVNext(source *vNext.Person) error { 14 | 15 | // release 16 | if source.release != nil { 17 | release := Bucket(*source.release) 18 | person.release = release 19 | } else { 20 | person.release = "" 21 | } 22 | 23 | // No error 24 | return nil 25 | } 26 | 27 | // ConvertToVNext populates the provided destination Person from our Person 28 | func (person Person) ConvertToVNext(destination *vNext.Person) error { 29 | 30 | // release 31 | release := Bucket(person.release) 32 | destination.release = &release 33 | 34 | // No error 35 | return nil 36 | } 37 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/testdata/ConvertBetweenRequiredEnumAndRequiredEnum.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package vCurrent 5 | 6 | import "github.com/Azure/k8s-infra/hack/generated/_apis/Verification/vNext" 7 | 8 | type Person struct { 9 | release Bucket `json:"release"` 10 | } 11 | 12 | // ConvertFromVNext populates our Person from the provided source Person 13 | func (person Person) ConvertFromVNext(source *vNext.Person) error { 14 | 15 | // release 16 | release := Bucket(source.release) 17 | person.release = release 18 | 19 | // No error 20 | return nil 21 | } 22 | 23 | // ConvertToVNext populates the provided destination Person from our Person 24 | func (person Person) ConvertToVNext(destination *vNext.Person) error { 25 | 26 | // release 27 | release := Bucket(person.release) 28 | destination.release = release 29 | 30 | // No error 31 | return nil 32 | } 33 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/testdata/SetIntFromInt.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package vCurrent 5 | 6 | import "github.com/Azure/k8s-infra/hack/generated/_apis/Verification/vNext" 7 | 8 | type Person struct { 9 | age int `json:"age"` 10 | } 11 | 12 | // ConvertFromVNext populates our Person from the provided source Person 13 | func (person Person) ConvertFromVNext(source *vNext.Person) error { 14 | 15 | // age 16 | person.age = source.age 17 | 18 | // No error 19 | return nil 20 | } 21 | 22 | // ConvertToVNext populates the provided destination Person from our Person 23 | func (person Person) ConvertToVNext(destination *vNext.Person) error { 24 | 25 | // age 26 | destination.age = person.age 27 | 28 | // No error 29 | return nil 30 | } 31 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/testdata/SetIntFromOptionalInt.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package vCurrent 5 | 6 | import "github.com/Azure/k8s-infra/hack/generated/_apis/Verification/vNext" 7 | 8 | type Person struct { 9 | age int `json:"age"` 10 | } 11 | 12 | // ConvertFromVNext populates our Person from the provided source Person 13 | func (person Person) ConvertFromVNext(source *vNext.Person) error { 14 | 15 | // age 16 | if source.age != nil { 17 | person.age = *source.age 18 | } else { 19 | person.age = 0 20 | } 21 | 22 | // No error 23 | return nil 24 | } 25 | 26 | // ConvertToVNext populates the provided destination Person from our Person 27 | func (person Person) ConvertToVNext(destination *vNext.Person) error { 28 | 29 | // age 30 | age := person.age 31 | destination.age = &age 32 | 33 | // No error 34 | return nil 35 | } 36 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/testdata/SetOptionalStringFromOptionalString.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package vCurrent 5 | 6 | import "github.com/Azure/k8s-infra/hack/generated/_apis/Verification/vNext" 7 | 8 | type Person struct { 9 | name *string `json:"name"` 10 | } 11 | 12 | // ConvertFromVNext populates our Person from the provided source Person 13 | func (person Person) ConvertFromVNext(source *vNext.Person) error { 14 | 15 | // name 16 | if source.name != nil { 17 | name := *source.name 18 | person.name = &name 19 | } else { 20 | person.name = nil 21 | } 22 | 23 | // No error 24 | return nil 25 | } 26 | 27 | // ConvertToVNext populates the provided destination Person from our Person 28 | func (person Person) ConvertToVNext(destination *vNext.Person) error { 29 | 30 | // name 31 | if person.name != nil { 32 | name := *person.name 33 | destination.name = &name 34 | } else { 35 | destination.name = nil 36 | } 37 | 38 | // No error 39 | return nil 40 | } 41 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/testdata/SetOptionalStringFromString.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package vCurrent 5 | 6 | import "github.com/Azure/k8s-infra/hack/generated/_apis/Verification/vNext" 7 | 8 | type Person struct { 9 | name *string `json:"name"` 10 | } 11 | 12 | // ConvertFromVNext populates our Person from the provided source Person 13 | func (person Person) ConvertFromVNext(source *vNext.Person) error { 14 | 15 | // name 16 | name := source.name 17 | person.name = &name 18 | 19 | // No error 20 | return nil 21 | } 22 | 23 | // ConvertToVNext populates the provided destination Person from our Person 24 | func (person Person) ConvertToVNext(destination *vNext.Person) error { 25 | 26 | // name 27 | if person.name != nil { 28 | destination.name = *person.name 29 | } else { 30 | destination.name = "" 31 | } 32 | 33 | // No error 34 | return nil 35 | } 36 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/testdata/SetStringFromOptionalString.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package vCurrent 5 | 6 | import "github.com/Azure/k8s-infra/hack/generated/_apis/Verification/vNext" 7 | 8 | type Person struct { 9 | name string `json:"name"` 10 | } 11 | 12 | // ConvertFromVNext populates our Person from the provided source Person 13 | func (person Person) ConvertFromVNext(source *vNext.Person) error { 14 | 15 | // name 16 | if source.name != nil { 17 | person.name = *source.name 18 | } else { 19 | person.name = "" 20 | } 21 | 22 | // No error 23 | return nil 24 | } 25 | 26 | // ConvertToVNext populates the provided destination Person from our Person 27 | func (person Person) ConvertToVNext(destination *vNext.Person) error { 28 | 29 | // name 30 | name := person.name 31 | destination.name = &name 32 | 33 | // No error 34 | return nil 35 | } 36 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/testdata/SetStringFromString.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package vCurrent 5 | 6 | import "github.com/Azure/k8s-infra/hack/generated/_apis/Verification/vNext" 7 | 8 | type Person struct { 9 | name string `json:"name"` 10 | } 11 | 12 | // ConvertFromVNext populates our Person from the provided source Person 13 | func (person Person) ConvertFromVNext(source *vNext.Person) error { 14 | 15 | // name 16 | person.name = source.name 17 | 18 | // No error 19 | return nil 20 | } 21 | 22 | // ConvertToVNext populates the provided destination Person from our Person 23 | func (person Person) ConvertToVNext(destination *vNext.Person) error { 24 | 25 | // name 26 | destination.name = person.name 27 | 28 | // No error 29 | return nil 30 | } 31 | -------------------------------------------------------------------------------- /hack/generator/pkg/astmodel/type_association.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package astmodel 7 | 8 | // TypeAssociation defines an association between two types 9 | type TypeAssociation map[TypeName]TypeName 10 | 11 | func (ts TypeAssociation) Equals(other TypeAssociation) bool { 12 | if len(ts) != len(other) { 13 | // Different sizes, not equal 14 | return false 15 | } 16 | 17 | for k, otherVal := range other { 18 | val, ok := ts[k] 19 | if !ok { 20 | // Missing key, not equal 21 | return false 22 | } 23 | 24 | if !val.Equals(otherVal) { 25 | // Values don't match, not equal 26 | return false 27 | } 28 | } 29 | 30 | return true 31 | } 32 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/pipeline_remove_embedded_resources.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package codegen 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/Azure/k8s-infra/hack/generator/pkg/astmodel" 12 | "github.com/Azure/k8s-infra/hack/generator/pkg/codegen/embeddedresources" 13 | ) 14 | 15 | func removeEmbeddedResources() PipelineStage { 16 | return MakePipelineStage( 17 | "removeEmbeddedResources", 18 | "Removes properties that point to embedded resources. Only removes structural aspects of embedded resources, Id/ARMId references are retained.", 19 | func(ctx context.Context, types astmodel.Types) (astmodel.Types, error) { 20 | 21 | remover, err := embeddedresources.MakeEmbeddedResourceRemover(types) 22 | if err != nil { 23 | return nil, err 24 | } 25 | 26 | return remover.RemoveEmbeddedResources() 27 | }) 28 | } 29 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/pipeline_target.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package codegen 7 | 8 | import ( 9 | "fmt" 10 | ) 11 | 12 | // PipelineTarget is used to classify what kind of pipeline we have 13 | // Deliberately wraps a string because we *do* *not* want type compatibility with literal strings 14 | type PipelineTarget struct { 15 | name string 16 | } 17 | 18 | var _ fmt.Stringer = PipelineTarget{} 19 | 20 | var ( 21 | // ARMTarget is used to tag stages that are required when generating types for working directly with Azure 22 | ARMTarget PipelineTarget = MakePipelineTarget("azure") 23 | 24 | // CrossplaneTarget is used to tag stages that are required when generating types for working with Crossplane 25 | CrossplaneTarget PipelineTarget = MakePipelineTarget("crossplane") 26 | ) 27 | 28 | func MakePipelineTarget(tag string) PipelineTarget { 29 | return PipelineTarget{ 30 | name: tag, 31 | } 32 | } 33 | 34 | func (t PipelineTarget) String() string { 35 | return t.name 36 | } 37 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/.gitattributes: -------------------------------------------------------------------------------- 1 | # golden files must not have the platform’s line endings: 2 | *.golden -text 3 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AdditionalProperties/Generates_field_if_other_fields_present.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | Tags *Test_Tags `json:"tags,omitempty"` 9 | } 10 | 11 | type Test_Tags struct { 12 | OtherField *string `json:"otherField,omitempty"` 13 | additionalProperties map[string]float64 `json:"additionalProperties"` 14 | } 15 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AdditionalProperties/Generates_field_if_other_fields_present.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Here we check that if other properties are present, then 'additionalProperties' will be generated as a field", 3 | 4 | "id": "https://test.test/schemas/2020-01-01/test.json", 5 | "$schema": "http://json-schema.org/draft-04/schema#", 6 | "title": "Test", 7 | "type": "object", 8 | "properties": { 9 | "tags": { 10 | "type": "object", 11 | "properties": { 12 | "otherField": { 13 | "type": "string" 14 | } 15 | }, 16 | "additionalProperties": { 17 | "type": "number" 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AdditionalProperties/Generates_map[string]interface{}_if_unset_and_no_other_fields_present.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | import "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" 7 | 8 | //Generated from: https://test.test/schemas/2020-01-01/test.json 9 | type Test struct { 10 | Tags map[string]v1.JSON `json:"tags,omitempty"` 11 | } 12 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AdditionalProperties/Generates_map[string]interface{}_if_unset_and_no_other_fields_present.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Here we check that if there are no other fields and 'additionalProperties' is not explicitly set, a map type of map[string]interface{} will be generated", 3 | 4 | "id": "https://test.test/schemas/2020-01-01/test.json", 5 | "$schema": "http://json-schema.org/draft-04/schema#", 6 | "title": "Test", 7 | "type": "object", 8 | "properties": { 9 | "tags": { 10 | "type": "object" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AdditionalProperties/Generates_map_type_if_no_other_fields_present.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | Tags map[string]float64 `json:"tags,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AdditionalProperties/Generates_map_type_if_no_other_fields_present.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Here we check that if 'additionalProperties' is set and there are no other fields, then the overall type will be a map type not a struct", 3 | 4 | "id": "https://test.test/schemas/2020-01-01/test.json", 5 | "$schema": "http://json-schema.org/draft-04/schema#", 6 | "title": "Test", 7 | "type": "object", 8 | "properties": { 9 | "tags": { 10 | "type": "object", 11 | "additionalProperties": { 12 | "type": "number" 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AdditionalProperties/Generates_nothing_if_set_to_'false'.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | Tags *Test_Tags `json:"tags,omitempty"` 9 | } 10 | 11 | type Test_Tags struct { 12 | } 13 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AdditionalProperties/Generates_nothing_if_set_to_'false'.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Here we check that if 'additionalProperties' is explicitly set to 'false' (and there are no other fields) the generated struct will be empty", 3 | 4 | "id": "https://test.test/schemas/2020-01-01/test.json", 5 | "$schema": "http://json-schema.org/draft-04/schema#", 6 | "title": "Test", 7 | "type": "object", 8 | "properties": { 9 | "tags": { 10 | "type": "object", 11 | "additionalProperties": false 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AdditionalProperties/Generates_nothing_if_unset_and_other_fields_present.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | Tags *Test_Tags `json:"tags,omitempty"` 9 | } 10 | 11 | type Test_Tags struct { 12 | OtherField *string `json:"otherField,omitempty"` 13 | } 14 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AdditionalProperties/Generates_nothing_if_unset_and_other_fields_present.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Here we check that if there are other fields present and 'additionalProperties' is not explicitly set then nothing additional is generated (this is against spec but see 'additionalProperties' comments in jsonast)", 3 | 4 | "id": "https://test.test/schemas/2020-01-01/test.json", 5 | "$schema": "http://json-schema.org/draft-04/schema#", 6 | "title": "Test", 7 | "type": "object", 8 | "properties": { 9 | "tags": { 10 | "type": "object", 11 | "properties": { 12 | "otherField": { 13 | "type": "string" 14 | } 15 | } 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AllOf/AllOf_collapses_duplicate_named_types.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test Foo 8 | 9 | //Generated from: https://test.test/schemas/2020-01-01/test.json#/definitions/Foo 10 | type Foo struct { 11 | Name *string `json:"name,omitempty"` 12 | } 13 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AllOf/AllOf_collapses_duplicate_named_types.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Check that the AllOf handler properly collapses duplicate references into a single type", 3 | "id": "https://test.test/schemas/2020-01-01/test.json", 4 | "$schema": "http://json-schema.org/draft-04/schema#", 5 | "title": "Test", 6 | "type": "object", 7 | "allOf": [ 8 | { 9 | "$ref": "#/definitions/Foo" 10 | }, 11 | { 12 | "$ref": "#/definitions/Foo" 13 | }, 14 | { 15 | "$ref": "#/definitions/Foo" 16 | } 17 | ], 18 | "definitions": { 19 | "Foo": { 20 | "type": "object", 21 | "properties": { 22 | "name": { 23 | "type": "string" 24 | } 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AllOf/AllOf_collapses_duplicate_unnamed_types.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | Name *string `json:"name,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AllOf/AllOf_collapses_duplicate_unnamed_types.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Check that the AllOf handler properly collapses duplicate anonymous type shapes into a single type", 3 | "id": "https://test.test/schemas/2020-01-01/test.json", 4 | "$schema": "http://json-schema.org/draft-04/schema#", 5 | "title": "Test", 6 | "type": "object", 7 | "allOf": [ 8 | { 9 | "type": "object", 10 | "properties": { 11 | "name": { 12 | "type": "string" 13 | } 14 | } 15 | }, 16 | { 17 | "type": "object", 18 | "properties": { 19 | "name": { 20 | "type": "string" 21 | } 22 | } 23 | }, 24 | { 25 | "type": "object", 26 | "properties": { 27 | "name": { 28 | "type": "string" 29 | } 30 | } 31 | } 32 | ] 33 | } -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AllOf/AllOf_generates_wrapper_type.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | // +kubebuilder:validation:Required 9 | Enabled bool `json:"enabled"` 10 | Name *string `json:"name,omitempty"` 11 | 12 | // +kubebuilder:validation:Required 13 | Size int `json:"size"` 14 | } 15 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AllOf/AllOf_handles_properties_on_owning_node.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | Length *int `json:"length,omitempty"` 9 | Width *int `json:"width,omitempty"` 10 | } 11 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AllOf/AllOf_handles_properties_on_owning_node.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "$comment": "Check that the AllOf handler correctly handles properties on the “owning” schema node" , 4 | "id": "https://test.test/schemas/2020-01-01/test.json", 5 | "$schema": "http://json-schema.org/draft-04/schema#", 6 | "title": "Test", 7 | "type": "object", 8 | "allOf": [ 9 | { 10 | "$ref": "#/definitions/Base" 11 | } 12 | ], 13 | "properties": { 14 | "width": { 15 | "type": "integer" 16 | } 17 | }, 18 | "definitions": { 19 | "Base": { 20 | "type": "object", 21 | "properties": { 22 | "length": { 23 | "type": "integer" 24 | } 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AllOf/AllOf_ignores_description_only_schema.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | X *float64 `json:"x,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AllOf/AllOf_ignores_description_only_schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Check that the AllOf handler ignores schemas that contain only a description", 3 | "id": "https://test.test/schemas/2020-01-01/test.json", 4 | "$schema": "http://json-schema.org/draft-04/schema#", 5 | "title": "Test", 6 | "type": "object", 7 | "allOf": [ 8 | { 9 | "description": "this should be ignored" 10 | }, 11 | { 12 | "properties": { 13 | "x": { 14 | "type" :"number" 15 | } 16 | } 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AllOf/AllOf_turns_map_type_back_into_additionalProperties.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | // +kubebuilder:validation:Required 9 | Size int `json:"size"` 10 | additionalProperties map[string]bool `json:"additionalProperties"` 11 | } 12 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/AllOf/AllOf_turns_map_type_back_into_additionalProperties.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Check that the AllOf handler converts a map type back into an additionalProperties field.", 3 | "id": "https://test.test/schemas/2020-01-01/test.json", 4 | "$schema": "http://json-schema.org/draft-04/schema#", 5 | "title": "Test", 6 | "type": "object", 7 | "allOf": [ 8 | { 9 | "$ref": "#/definitions/MapType" 10 | }, 11 | { 12 | "$ref": "#/definitions/OtherObject" 13 | } 14 | ], 15 | "definitions": { 16 | "MapType": { 17 | "type": "object", 18 | "additionalProperties": { 19 | "type": "boolean" 20 | } 21 | }, 22 | "OtherObject": { 23 | "type": "object", 24 | "properties": { 25 | "size": { 26 | "type": "integer" 27 | } 28 | }, 29 | "required": [ 30 | "size" 31 | ] 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/ArmResource/config.yaml: -------------------------------------------------------------------------------- 1 | hasArmResources: true 2 | pipelines: 3 | - azure 4 | - crossplane 5 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/EmbeddedTypes/config.yaml: -------------------------------------------------------------------------------- 1 | hasArmResources: true 2 | injectEmbeddedStruct: true 3 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/Enum/Boolean_enum.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | MyEnum *TestMyEnum `json:"myEnum,omitempty"` 9 | } 10 | 11 | // +kubebuilder:validation:Enum={true} 12 | type TestMyEnum bool 13 | 14 | const TestMyEnumTrue = TestMyEnum(true) 15 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/Enum/Boolean_enum.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Check that an enum with base type of Boolean is correctly generated", 3 | "id": "https://test.test/schemas/2020-01-01/test.json", 4 | "$schema": "http://json-schema.org/draft-04/schema#", 5 | "title": "Test", 6 | "type": "object", 7 | "properties": { 8 | "myEnum": { 9 | "type": "boolean", 10 | "enum": [ 11 | true 12 | ] 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/Enum/Boolean_enum_value_with_quotes.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | MyEnum *TestMyEnum `json:"myEnum,omitempty"` 9 | } 10 | 11 | // +kubebuilder:validation:Enum={true} 12 | type TestMyEnum bool 13 | 14 | const TestMyEnumTrue = TestMyEnum(true) 15 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/Enum/Boolean_enum_value_with_quotes.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Check that an enum with base type of Boolean is correctly generated", 3 | "id": "https://test.test/schemas/2020-01-01/test.json", 4 | "$schema": "http://json-schema.org/draft-04/schema#", 5 | "title": "Test", 6 | "type": "object", 7 | "properties": { 8 | "myEnum": { 9 | "type": "boolean", 10 | "enum": [ 11 | "true" 12 | ] 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/Enum/Enum_with_star_value.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | MyEnum *TestMyEnum `json:"myEnum,omitempty"` 9 | } 10 | 11 | // +kubebuilder:validation:Enum={"a","b","*"} 12 | type TestMyEnum string 13 | 14 | const ( 15 | TestMyEnumA = TestMyEnum("a") 16 | TestMyEnumB = TestMyEnum("b") 17 | TestMyEnumStar = TestMyEnum("*") 18 | ) 19 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/Enum/Enum_with_star_value.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Check that an enum with base type of Boolean is correctly generated", 3 | "id": "https://test.test/schemas/2020-01-01/test.json", 4 | "$schema": "http://json-schema.org/draft-04/schema#", 5 | "title": "Test", 6 | "type": "object", 7 | "properties": { 8 | "myEnum": { 9 | "type": "string", 10 | "enum": [ 11 | "a", 12 | "b", 13 | "*" 14 | ] 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/EnumNames/config.yaml: -------------------------------------------------------------------------------- 1 | hasArmResources: true 2 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/OneOf/OneOf_collapses_duplicate_named_types.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test Foo 8 | 9 | //Generated from: https://test.test/schemas/2020-01-01/test.json#/definitions/Foo 10 | type Foo struct { 11 | Name *string `json:"name,omitempty"` 12 | } 13 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/OneOf/OneOf_collapses_duplicate_named_types.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Check that the OneOf handler properly collapses duplicate references into a single type", 3 | "id": "https://test.test/schemas/2020-01-01/test.json", 4 | "$schema": "http://json-schema.org/draft-04/schema#", 5 | "title": "Test", 6 | "type": "object", 7 | "oneOf": [ 8 | { 9 | "$ref": "#/definitions/Foo" 10 | }, 11 | { 12 | "$ref": "#/definitions/Foo" 13 | }, 14 | { 15 | "$ref": "#/definitions/Foo" 16 | } 17 | ], 18 | "definitions": { 19 | "Foo": { 20 | "type": "object", 21 | "properties": { 22 | "name": { 23 | "type": "string" 24 | } 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/OneOf/OneOf_collapses_duplicate_unnamed_types.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | Name *string `json:"name,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/OneOf/OneOf_collapses_duplicate_unnamed_types.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Check that the OneOf handler properly collapses duplicate anonymous type shapes into a single type", 3 | "id": "https://test.test/schemas/2020-01-01/test.json", 4 | "$schema": "http://json-schema.org/draft-04/schema#", 5 | "title": "Test", 6 | "type": "object", 7 | "oneOf": [ 8 | { 9 | "type": "object", 10 | "properties": { 11 | "name": { 12 | "type": "string" 13 | } 14 | } 15 | }, 16 | { 17 | "type": "object", 18 | "properties": { 19 | "name": { 20 | "type": "string" 21 | } 22 | } 23 | }, 24 | { 25 | "type": "object", 26 | "properties": { 27 | "name": { 28 | "type": "string" 29 | } 30 | } 31 | } 32 | ] 33 | } -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/OneOf/OneOf_generates_wrapper_type_with_named_properties_from_anonymous_types.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | //Bool1: Mutually exclusive with all other properties 9 | Bool1 *bool `json:"bool1,omitempty"` 10 | 11 | //Foo: Mutually exclusive with all other properties 12 | Foo *Foo `json:"foo,omitempty"` 13 | 14 | //Object2: Mutually exclusive with all other properties 15 | Object2 *Test_Object2 `json:"object2,omitempty"` 16 | } 17 | 18 | //Generated from: https://test.test/schemas/2020-01-01/test.json#/definitions/Foo 19 | type Foo struct { 20 | Name *string `json:"name,omitempty"` 21 | } 22 | 23 | type Test_Object2 struct { 24 | Foo *string `json:"foo,omitempty"` 25 | } 26 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/OneOf/OneOf_generates_wrapper_type_with_named_properties_from_anonymous_types.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Here we check that optional properties should generate pointers in the result", 3 | "id": "https://test.test/schemas/2020-01-01/test.json", 4 | "$schema": "http://json-schema.org/draft-04/schema#", 5 | "title": "Test", 6 | "type": "object", 7 | "oneOf": [ 8 | { 9 | "$ref": "#/definitions/Foo" 10 | }, 11 | { 12 | "type": "boolean" 13 | }, 14 | { 15 | "type": "object", 16 | "properties": { 17 | "foo": { 18 | "type": "string" 19 | } 20 | } 21 | } 22 | ], 23 | "definitions": { 24 | "Foo": { 25 | "type": "object", 26 | "properties": { 27 | "name": { 28 | "type": "string" 29 | } 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/OneOf/OneOf_handles_properties_on_owning_node.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | //Either: Mutually exclusive with all other properties 9 | Either *Test_Either `json:"either,omitempty"` 10 | 11 | //Or: Mutually exclusive with all other properties 12 | Or *Test_Or `json:"or,omitempty"` 13 | } 14 | 15 | type Test_Either struct { 16 | Height *int `json:"height,omitempty"` 17 | Width *int `json:"width,omitempty"` 18 | } 19 | 20 | type Test_Or struct { 21 | Length *int `json:"length,omitempty"` 22 | Width *int `json:"width,omitempty"` 23 | } 24 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/OneOf/OneOf_preserves_names.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | //Base: Mutually exclusive with all other properties 9 | Base *Test_Base `json:"base,omitempty"` 10 | 11 | //Inherited: Mutually exclusive with all other properties 12 | Inherited *Test_Inherited `json:"inherited,omitempty"` 13 | } 14 | 15 | type Test_Base struct { 16 | Width *int `json:"width,omitempty"` 17 | } 18 | 19 | type Test_Inherited struct { 20 | Height *int `json:"height,omitempty"` 21 | Width *int `json:"width,omitempty"` 22 | } 23 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/RemoveTypeAliasesPipeline/RemoveTypeAliases_all_aliases_are_inlined.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | P1 [][][]float64 `json:"p1,omitempty"` 9 | P2 [][]float64 `json:"p2,omitempty"` 10 | P3 []float64 `json:"p3,omitempty"` 11 | P4 *float64 `json:"p4,omitempty"` 12 | } 13 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/RemoveTypeAliasesPipeline/RemoveTypeAliases_removes_type_alias.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | Foo *Foo `json:"foo,omitempty"` 9 | FooAlias *Foo `json:"fooAlias,omitempty"` 10 | StringAlias *string `json:"stringAlias,omitempty"` 11 | StringArrayAlias []string `json:"stringArrayAlias,omitempty"` 12 | } 13 | 14 | //Generated from: https://test.test/schemas/2020-01-01/test.json#/definitions/Foo 15 | type Foo struct { 16 | Name *string `json:"name,omitempty"` 17 | } 18 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/UnreferencedDefinitions/unreferenced_definitions_are_not_generated.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | Name *string `json:"name,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/Validations/Enums_have_required_validation.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | // +kubebuilder:validation:Required 9 | Color TestColor `json:"color"` 10 | } 11 | 12 | // +kubebuilder:validation:Enum={"blue","green","red"} 13 | type TestColor string 14 | 15 | const ( 16 | TestColorBlue = TestColor("blue") 17 | TestColorGreen = TestColor("green") 18 | TestColorRed = TestColor("red") 19 | ) 20 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/Validations/Enums_have_required_validation.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Check that enum fields get the required validation specifying their valid values", 3 | 4 | "id": "https://test.test/schemas/2020-01-01/test.json", 5 | "$schema": "http://json-schema.org/draft-04/schema#", 6 | "title": "Test", 7 | "type": "object", 8 | "properties": { 9 | "color": { 10 | "type": "string", 11 | "enum": ["red", "blue", "green"] 12 | } 13 | }, 14 | "required": ["color"] 15 | } 16 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/Validations/Optional_properties_are_pointers.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | NotRequired *string `json:"notRequired,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/Validations/Optional_properties_are_pointers.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Here we check that optional properties should generate pointers in the result", 3 | 4 | "id": "https://test.test/schemas/2020-01-01/test.json", 5 | "$schema": "http://json-schema.org/draft-04/schema#", 6 | "title": "Test", 7 | "type": "object", 8 | "properties": { 9 | "notRequired": { 10 | "type": "string" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/Validations/Optional_unknown_type_is_generated_as_interface.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | import "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" 7 | 8 | //Generated from: https://test.test/schemas/2020-01-01/test.json 9 | type Test struct { 10 | Foo *v1.JSON `json:"foo,omitempty"` 11 | } 12 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/Validations/Optional_unknown_type_is_generated_as_interface.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Check that a type with a property with no type specified is generated as interface{}", 3 | "id": "https://test.test/schemas/2020-01-01/test.json", 4 | "$schema": "http://json-schema.org/draft-04/schema#", 5 | "title": "Test", 6 | "type": "object", 7 | "properties": { 8 | "foo": { 9 | "$ref": "#/definitions/Foo" 10 | } 11 | }, 12 | "definitions": { 13 | "Foo": { 14 | "description": "The foo." 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/Validations/Required_properties_have_appropriate_comment.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | // +kubebuilder:validation:Required 9 | Required string `json:"required"` 10 | } 11 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/Validations/Required_properties_have_appropriate_comment.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Here we check that generating validation comments for required properties works as expected", 3 | 4 | "id": "https://test.test/schemas/2020-01-01/test.json", 5 | "$schema": "http://json-schema.org/draft-04/schema#", 6 | "title": "Test", 7 | "type": "object", 8 | "properties": { 9 | "required": { 10 | "type": "string" 11 | } 12 | }, 13 | "required": ["required"] 14 | } -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/Validations/Validate_nested_types.golden: -------------------------------------------------------------------------------- 1 | // Code generated by k8s-infra. DO NOT EDIT. 2 | // Copyright (c) Microsoft Corporation. 3 | // Licensed under the MIT license. 4 | package v1alpha1api20200101 5 | 6 | //Generated from: https://test.test/schemas/2020-01-01/test.json 7 | type Test struct { 8 | // +kubebuilder:validation:Required 9 | Ducks []Test_Ducks `json:"ducks"` 10 | } 11 | 12 | // +kubebuilder:validation:MaxLength=20 13 | // +kubebuilder:validation:MinLength=10 14 | // +kubebuilder:validation:Pattern="^[a-z]+$" 15 | type Test_Ducks string 16 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/testdata/Validations/Validate_nested_types.json: -------------------------------------------------------------------------------- 1 | { 2 | "$comment": "Here we check that nested types with validations are properly pulled out and named", 3 | 4 | "id": "https://test.test/schemas/2020-01-01/test.json", 5 | "$schema": "http://json-schema.org/draft-04/schema#", 6 | "title": "Test", 7 | "type": "object", 8 | "properties": { 9 | "ducks": { 10 | "type": "array", 11 | "items": { 12 | "type": "string", 13 | "maxLength": 20, 14 | "minLength": 10, 15 | "pattern": "^[a-z]+$" 16 | } 17 | } 18 | }, 19 | "required": ["ducks"] 20 | } 21 | -------------------------------------------------------------------------------- /hack/generator/pkg/codegen/version.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package codegen 7 | 8 | import ( 9 | "fmt" 10 | ) 11 | 12 | // GitCommit and GitTreeState are populated by the Makefile. 13 | var ( 14 | GitCommit string 15 | GitTreeState string 16 | ) 17 | 18 | func combinedVersion() string { 19 | result := GitCommit 20 | if GitTreeState != "clean" { 21 | result += fmt.Sprintf(" (tree is %s)", GitTreeState) 22 | } 23 | return result 24 | } 25 | -------------------------------------------------------------------------------- /hack/generator/pkg/config/configuration_private_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package config 7 | 8 | import ( 9 | "testing" 10 | 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func Test_CanMakeUnixStylePathIntoURL(t *testing.T) { 15 | g := NewGomegaWithT(t) 16 | 17 | url := absDirectoryPathToURL("/somewhere/over/the/rainbow") 18 | g.Expect(url.String()).To(Equal("file:///somewhere/over/the/rainbow/")) 19 | } 20 | 21 | func Test_CanMakeWindowsPathIntoURL(t *testing.T) { 22 | g := NewGomegaWithT(t) 23 | 24 | url := absDirectoryPathToURL("D:\\yellow\\brick\\road") 25 | g.Expect(url.String()).To(Equal("file:///D:/yellow/brick/road/")) 26 | } 27 | -------------------------------------------------------------------------------- /hack/generator/pkg/config/type_filter.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package config 7 | 8 | // TypeFilterAction defines the possible actions that should happen for types matching the filter 9 | type TypeFilterAction string 10 | 11 | const ( 12 | // TypeFilterInclude indicates that any type matched by the filter should be included in the type graph 13 | TypeFilterInclude TypeFilterAction = "include" 14 | // TypeFilterPrune indicates that any type matched by the filter, and any types only referenced by that type 15 | // should not be included in the type graph 16 | TypeFilterPrune TypeFilterAction = "prune" 17 | ) 18 | 19 | // A TypeFilter is used to control which types should be included in the type graph when running the generator 20 | type TypeFilter struct { 21 | Action TypeFilterAction 22 | TypeMatcher `yaml:",inline"` 23 | } 24 | -------------------------------------------------------------------------------- /hack/generator/pkg/jsonast/object_type_of_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package jsonast 7 | 8 | import ( 9 | "net/url" 10 | "testing" 11 | 12 | . "github.com/onsi/gomega" 13 | ) 14 | 15 | func Test_ObjectTypeOf(t *testing.T) { 16 | g := NewGomegaWithT(t) 17 | 18 | url, err := url.Parse("https://schema.management.azure.com/schemas/2015-01-01/Microsoft.Resources.json#/resourceDefinitions/deployments") 19 | g.Expect(err).To(BeNil()) 20 | 21 | name, err := objectTypeOf(url) 22 | g.Expect(err).To(BeNil()) 23 | g.Expect(name).To(Equal("deployments")) 24 | } 25 | -------------------------------------------------------------------------------- /hack/generator/pkg/jsonast/versionof_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package jsonast 7 | 8 | import ( 9 | "net/url" 10 | "testing" 11 | 12 | . "github.com/onsi/gomega" 13 | ) 14 | 15 | func Test_ExtractObjectAndVersion(t *testing.T) { 16 | g := NewGomegaWithT(t) 17 | 18 | url, err := url.Parse("https://schema.management.azure.com/schemas/2015-01-01/Microsoft.Resources.json#/resourceDefinitions/deployments") 19 | g.Expect(err).To(BeNil()) 20 | 21 | version := versionOf(url) 22 | g.Expect(version).To(Equal("2015-01-01")) 23 | } 24 | -------------------------------------------------------------------------------- /hack/generator/pkg/reporting/table_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. 3 | * Licensed under the MIT license. 4 | */ 5 | 6 | package reporting 7 | 8 | import ( 9 | "fmt" 10 | "github.com/sebdah/goldie/v2" 11 | "strings" 12 | "testing" 13 | ) 14 | 15 | func TestTable_StepByStep_GivesExpectedResults(t *testing.T) { 16 | steps := []struct { 17 | row string 18 | col string 19 | cell string 20 | }{ 21 | {"1", "prime", "(yes)"}, 22 | {"1", "square", "yes"}, 23 | {"2", "prime", "yes"}, 24 | {"3", "prime", "yes"}, 25 | {"3", "triangle", "yes"}, 26 | {"4", "square", "yes"}, 27 | {"5", "prime", "yes"}, 28 | {"6", "triangle", "yes"}, 29 | {"7", "prime", "yes"}, 30 | {"9", "square", "yes"}, 31 | {"10", "triangle", "yes"}, 32 | } 33 | 34 | table := NewTable() 35 | g := goldie.New(t) 36 | for i, s := range steps { 37 | table.SetCell(s.row, s.col, s.cell) 38 | 39 | var buff strings.Builder 40 | table.WriteTo(&buff) 41 | 42 | testName := fmt.Sprintf("%s_step_%d", t.Name(), i) 43 | g.Assert(t, testName, []byte(buff.String())) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /hack/generator/pkg/reporting/testdata/TestTable_StepByStep_GivesExpectedResults_step_0.golden: -------------------------------------------------------------------------------- 1 | | | prime | 2 | |---|-------| 3 | | 1 | (yes) | 4 | -------------------------------------------------------------------------------- /hack/generator/pkg/reporting/testdata/TestTable_StepByStep_GivesExpectedResults_step_1.golden: -------------------------------------------------------------------------------- 1 | | | prime | square | 2 | |---|-------|--------| 3 | | 1 | (yes) | yes | 4 | -------------------------------------------------------------------------------- /hack/generator/pkg/reporting/testdata/TestTable_StepByStep_GivesExpectedResults_step_10.golden: -------------------------------------------------------------------------------- 1 | | | prime | square | triangle | 2 | |----|-------|--------|----------| 3 | | 1 | (yes) | yes | | 4 | | 2 | yes | | | 5 | | 3 | yes | | yes | 6 | | 4 | | yes | | 7 | | 5 | yes | | | 8 | | 6 | | | yes | 9 | | 7 | yes | | | 10 | | 9 | | yes | | 11 | | 10 | | | yes | 12 | -------------------------------------------------------------------------------- /hack/generator/pkg/reporting/testdata/TestTable_StepByStep_GivesExpectedResults_step_2.golden: -------------------------------------------------------------------------------- 1 | | | prime | square | 2 | |---|-------|--------| 3 | | 1 | (yes) | yes | 4 | | 2 | yes | | 5 | -------------------------------------------------------------------------------- /hack/generator/pkg/reporting/testdata/TestTable_StepByStep_GivesExpectedResults_step_3.golden: -------------------------------------------------------------------------------- 1 | | | prime | square | 2 | |---|-------|--------| 3 | | 1 | (yes) | yes | 4 | | 2 | yes | | 5 | | 3 | yes | | 6 | -------------------------------------------------------------------------------- /hack/generator/pkg/reporting/testdata/TestTable_StepByStep_GivesExpectedResults_step_4.golden: -------------------------------------------------------------------------------- 1 | | | prime | square | triangle | 2 | |---|-------|--------|----------| 3 | | 1 | (yes) | yes | | 4 | | 2 | yes | | | 5 | | 3 | yes | | yes | 6 | -------------------------------------------------------------------------------- /hack/generator/pkg/reporting/testdata/TestTable_StepByStep_GivesExpectedResults_step_5.golden: -------------------------------------------------------------------------------- 1 | | | prime | square | triangle | 2 | |---|-------|--------|----------| 3 | | 1 | (yes) | yes | | 4 | | 2 | yes | | | 5 | | 3 | yes | | yes | 6 | | 4 | | yes | | 7 | -------------------------------------------------------------------------------- /hack/generator/pkg/reporting/testdata/TestTable_StepByStep_GivesExpectedResults_step_6.golden: -------------------------------------------------------------------------------- 1 | | | prime | square | triangle | 2 | |---|-------|--------|----------| 3 | | 1 | (yes) | yes | | 4 | | 2 | yes | | | 5 | | 3 | yes | | yes | 6 | | 4 | | yes | | 7 | | 5 | yes | | | 8 | -------------------------------------------------------------------------------- /hack/generator/pkg/reporting/testdata/TestTable_StepByStep_GivesExpectedResults_step_7.golden: -------------------------------------------------------------------------------- 1 | | | prime | square | triangle | 2 | |---|-------|--------|----------| 3 | | 1 | (yes) | yes | | 4 | | 2 | yes | | | 5 | | 3 | yes | | yes | 6 | | 4 | | yes | | 7 | | 5 | yes | | | 8 | | 6 | | | yes | 9 | -------------------------------------------------------------------------------- /hack/generator/pkg/reporting/testdata/TestTable_StepByStep_GivesExpectedResults_step_8.golden: -------------------------------------------------------------------------------- 1 | | | prime | square | triangle | 2 | |---|-------|--------|----------| 3 | | 1 | (yes) | yes | | 4 | | 2 | yes | | | 5 | | 3 | yes | | yes | 6 | | 4 | | yes | | 7 | | 5 | yes | | | 8 | | 6 | | | yes | 9 | | 7 | yes | | | 10 | -------------------------------------------------------------------------------- /hack/generator/pkg/reporting/testdata/TestTable_StepByStep_GivesExpectedResults_step_9.golden: -------------------------------------------------------------------------------- 1 | | | prime | square | triangle | 2 | |---|-------|--------|----------| 3 | | 1 | (yes) | yes | | 4 | | 2 | yes | | | 5 | | 3 | yes | | yes | 6 | | 4 | | yes | | 7 | | 5 | yes | | | 8 | | 6 | | | yes | 9 | | 7 | yes | | | 10 | | 9 | | yes | | 11 | -------------------------------------------------------------------------------- /hack/generator/pkg/xcobra/exit_handler.go: -------------------------------------------------------------------------------- 1 | //+build !noexit 2 | 3 | /* 4 | * Copyright (c) Microsoft Corporation. 5 | * Licensed under the MIT license. 6 | */ 7 | 8 | package xcobra 9 | 10 | import ( 11 | "errors" 12 | "os" 13 | ) 14 | 15 | func exitWithCode(err error) { 16 | if err == nil { 17 | return 18 | } 19 | 20 | var e ErrorWithCode 21 | if errors.As(err, &e) { 22 | os.Exit(e.Code) 23 | } 24 | 25 | os.Exit(1) 26 | } 27 | -------------------------------------------------------------------------------- /hack/generator/pkg/xcobra/noop_handler.go: -------------------------------------------------------------------------------- 1 | //+build noexit 2 | 3 | /* 4 | * Copyright (c) Microsoft Corporation. 5 | * Licensed under the MIT license. 6 | */ 7 | 8 | package xcobra 9 | 10 | func exitWithCode(err error) { 11 | // nop 12 | } 13 | -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-chained-storage/2011-01-01.dot: -------------------------------------------------------------------------------- 1 | graph { 2 | nodesep="1" 3 | 4 | node [shape=ellipse] 5 | v20110101 6 | 7 | node [shape=ellipse, penwidth=3] 8 | v20110101storage 9 | 10 | edge [arrowhead=vee, arrowtail=vee, dir=both] 11 | v20110101 -- v20110101storage 12 | } 13 | -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-chained-storage/2011-01-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-chained-storage/2011-01-01.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-chained-storage/2012-02-02.dot: -------------------------------------------------------------------------------- 1 | graph G { 2 | nodesep="1" 3 | 4 | subgraph apiVersions { 5 | rank=same; 6 | 7 | node [shape=ellipse, group=api]; 8 | v20110101; 9 | v20120202; 10 | } 11 | 12 | 13 | subgraph storageVersions { 14 | rank=same; 15 | 16 | node [shape=ellipse, style=dashed, penwidth=1, rankType=min, group=storage]; 17 | v20110101storage; 18 | 19 | node [shape=ellipse, style=solid, penwidth=3]; 20 | v20120202storage; 21 | } 22 | 23 | edge [arrowhead=vee, arrowtail=vee, dir=both]; 24 | v20110101 -- v20110101storage; 25 | v20120202 -- v20120202storage [penwidth=2]; 26 | 27 | edge [arrowhead=vee, arrowtail=vee, dir=both]; 28 | v20110101storage -- v20120202storage [penwidth=2]; 29 | } -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-chained-storage/2012-02-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-chained-storage/2012-02-02.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-chained-storage/2013-03-03.dot: -------------------------------------------------------------------------------- 1 | graph G { 2 | nodesep="1" 3 | 4 | subgraph apiVersions { 5 | rank=same; 6 | label="API Versions"; 7 | labelloc=t 8 | 9 | node [shape=ellipse, group=api]; 10 | v20110101; 11 | v20120202; 12 | v20130303; 13 | } 14 | 15 | 16 | subgraph storageVersions { 17 | rank=same; 18 | 19 | node [shape=ellipse, penwidth=3]; 20 | v20130303storage; 21 | 22 | node [shape=ellipse, style=dashed, penwidth=1, rankType=min, group=storage]; 23 | v20110101storage; 24 | v20120202storage; 25 | } 26 | 27 | edge [arrowhead=vee, arrowtail=vee, dir=both]; 28 | v20110101 -- v20110101storage; 29 | v20120202 -- v20120202storage; 30 | v20130303 -- v20130303storage [penwidth=2]; 31 | 32 | edge [arrowhead=vee, arrowtail=vee, dir=both]; 33 | v20110101storage -- v20120202storage; 34 | v20120202storage -- v20130303storage [penwidth=2]; 35 | } 36 | -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-chained-storage/2013-03-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-chained-storage/2013-03-03.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-chained-storage/2014-04-04-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-chained-storage/2014-04-04-preview.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-chained-storage/2014-04-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-chained-storage/2014-04-04.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-chained-storage/2015-05-05-alternate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-chained-storage/2015-05-05-alternate.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-chained-storage/2015-05-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-chained-storage/2015-05-05.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-chained-storage/2016-06-06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-chained-storage/2016-06-06.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-chained-storage/2017-07-07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-chained-storage/2017-07-07.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-chained-storage/2018-08-08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-chained-storage/2018-08-08.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-chained-storage/2019-09-09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-chained-storage/2019-09-09.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2011-01-01.dot: -------------------------------------------------------------------------------- 1 | graph { 2 | node [shape=ellipse] 3 | v20110101 4 | 5 | node [shape=ellipse, penwidth=3] 6 | v1 7 | 8 | edge [arrowhead=vee, arrowtail=vee, dir=both] 9 | v20110101 -- v1 10 | } 11 | -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2011-01-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-fixed-storage/2011-01-01.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2012-02-02.dot: -------------------------------------------------------------------------------- 1 | graph G { 2 | subgraph apiVersions { 3 | rank=same; 4 | 5 | node [shape=ellipse, group=api]; 6 | v20110101; 7 | v20120202; 8 | } 9 | 10 | node [shape=ellipse, penwidth=3]; 11 | v1; 12 | 13 | edge [arrowhead=vee, arrowtail=vee, dir=both]; 14 | v20110101 -- v1; 15 | v20120202 -- v1; 16 | } -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2012-02-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-fixed-storage/2012-02-02.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2013-03-03.dot: -------------------------------------------------------------------------------- 1 | graph G { 2 | subgraph apiVersions { 3 | rank=same; 4 | label="API Versions"; 5 | labelloc=t 6 | 7 | node [shape=ellipse, group=api]; 8 | v20110101; 9 | v20120202; 10 | v20130303; 11 | } 12 | 13 | node [shape=ellipse, penwidth=3]; 14 | v1; 15 | 16 | edge [arrowhead=vee, arrowtail=vee, dir=both]; 17 | v20110101 -- v1; 18 | v20120202 -- v1; 19 | v20130303 -- v1; 20 | } 21 | -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2013-03-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-fixed-storage/2013-03-03.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2014-04-04-preview.dot: -------------------------------------------------------------------------------- 1 | graph G { 2 | subgraph apiVersions { 3 | rank=same; 4 | label="API Versions"; 5 | labelloc=t 6 | 7 | node [shape=ellipse, group=api]; 8 | v20110101; 9 | v20120202; 10 | v20130303; 11 | v20140404preview; 12 | } 13 | 14 | node [shape=ellipse, penwidth=3]; 15 | v1; 16 | 17 | edge [arrowhead=vee, arrowtail=vee, dir=both]; 18 | v20110101 -- v1; 19 | v20120202 -- v1; 20 | v20130303 -- v1; 21 | v20140404preview -- v1; 22 | } 23 | -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2014-04-04-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-fixed-storage/2014-04-04-preview.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2014-04-04.dot: -------------------------------------------------------------------------------- 1 | graph G { 2 | subgraph apiVersions { 3 | rank=same; 4 | label="API Versions"; 5 | labelloc=t 6 | 7 | node [shape=ellipse, group=api]; 8 | v20110101; 9 | v20120202; 10 | v20130303; 11 | v20140404preview; 12 | v20140404; 13 | } 14 | 15 | node [shape=ellipse, penwidth=3]; 16 | v1; 17 | 18 | edge [arrowhead=vee, arrowtail=vee, dir=both]; 19 | v20110101 -- v1; 20 | v20120202 -- v1; 21 | v20130303 -- v1; 22 | v20140404preview -- v1; 23 | v20140404 -- v1; 24 | } 25 | -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2014-04-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-fixed-storage/2014-04-04.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2015-05-05.dot: -------------------------------------------------------------------------------- 1 | graph G { 2 | subgraph apiVersions { 3 | rank=same; 4 | label="API Versions"; 5 | labelloc=t 6 | 7 | node [shape=ellipse, group=api]; 8 | v20120202; 9 | v20130303; 10 | v20140404preview; 11 | v20140404; 12 | v20150505; 13 | } 14 | 15 | node [shape=ellipse, penwidth=3]; 16 | v1; 17 | 18 | edge [arrowhead=vee, arrowtail=vee, dir=both]; 19 | v20120202 -- v1; 20 | v20130303 -- v1; 21 | v20140404preview -- v1; 22 | v20140404 -- v1; 23 | v20150505 -- v1; 24 | } 25 | -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2015-05-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-fixed-storage/2015-05-05.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2016-06-06.dot: -------------------------------------------------------------------------------- 1 | graph G { 2 | subgraph apiVersions { 3 | rank=same; 4 | label="API Versions"; 5 | labelloc=t 6 | 7 | node [shape=ellipse, group=api]; 8 | v20130303; 9 | v20140404preview; 10 | v20140404; 11 | v20150505; 12 | v20160606; 13 | } 14 | 15 | node [shape=ellipse, penwidth=3]; 16 | v1; 17 | 18 | edge [arrowhead=vee, arrowtail=vee, dir=both]; 19 | v20130303 -- v1; 20 | v20140404preview -- v1; 21 | v20140404 -- v1; 22 | v20150505 -- v1; 23 | v20160606 -- v1; 24 | } 25 | -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2016-06-06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-fixed-storage/2016-06-06.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2017-07-07.dot: -------------------------------------------------------------------------------- 1 | graph G { 2 | subgraph apiVersions { 3 | rank=same; 4 | label="API Versions"; 5 | labelloc=t 6 | 7 | node [shape=ellipse, group=api]; 8 | v20140404preview; 9 | v20140404; 10 | v20150505; 11 | v20160606; 12 | v20170707; 13 | } 14 | 15 | node [shape=ellipse, penwidth=3]; 16 | v1; 17 | 18 | edge [arrowhead=vee, arrowtail=vee, dir=both]; 19 | v20140404preview -- v1; 20 | v20140404 -- v1; 21 | v20150505 -- v1; 22 | v20160606 -- v1; 23 | v20170707 -- v1; 24 | } 25 | -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2017-07-07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-fixed-storage/2017-07-07.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2018-08-08.dot: -------------------------------------------------------------------------------- 1 | graph G { 2 | subgraph apiVersions { 3 | rank=same; 4 | label="API Versions"; 5 | labelloc=t 6 | 7 | node [shape=ellipse, group=api]; 8 | v20150505; 9 | v20160606; 10 | v20170707; 11 | v20180808; 12 | } 13 | 14 | node [shape=ellipse, penwidth=3]; 15 | v1; 16 | 17 | edge [arrowhead=vee, arrowtail=vee, dir=both]; 18 | v20150505 -- v1; 19 | v20160606 -- v1; 20 | v20170707 -- v1; 21 | v20180808 -- v1; 22 | } 23 | -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2018-08-08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-fixed-storage/2018-08-08.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2019-09-09.dot: -------------------------------------------------------------------------------- 1 | graph G { 2 | subgraph apiVersions { 3 | rank=same; 4 | label="API Versions"; 5 | labelloc=t 6 | 7 | node [shape=ellipse, group=api]; 8 | v20160606; 9 | v20170707; 10 | v20180808; 11 | v20190909; 12 | } 13 | 14 | node [shape=ellipse, penwidth=3]; 15 | v1; 16 | 17 | edge [arrowhead=vee, arrowtail=vee, dir=both]; 18 | v20160606 -- v1; 19 | v20170707 -- v1; 20 | v20180808 -- v1; 21 | v20190909 -- v1; 22 | } 23 | -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-fixed-storage/2019-09-09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-fixed-storage/2019-09-09.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-rolling-storage/2011-01-01.dot: -------------------------------------------------------------------------------- 1 | graph { 2 | node [shape=ellipse] 3 | v20110101 4 | 5 | node [shape=ellipse, penwidth=3] 6 | v20110101storage 7 | 8 | edge [arrowhead=vee, arrowtail=vee, dir=both] 9 | v20110101 -- v20110101storage 10 | } 11 | -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-rolling-storage/2011-01-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-rolling-storage/2011-01-01.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-rolling-storage/2012-02-02.dot: -------------------------------------------------------------------------------- 1 | graph G { 2 | subgraph apiVersions { 3 | rank=same; 4 | 5 | node [shape=ellipse, group=api]; 6 | v20110101; 7 | v20120202; 8 | } 9 | 10 | node [shape=ellipse, penwidth=3]; 11 | v20120202storage; 12 | 13 | subgraph storageVersions { 14 | rank=same; 15 | 16 | node [shape=ellipse, style=dashed, penwidth=1, rankType=min, group=storage]; 17 | v20110101storage; 18 | } 19 | 20 | edge [arrowhead=vee, arrowtail=vee, dir=both]; 21 | v20110101 -- v20120202storage; 22 | v20120202 -- v20120202storage; 23 | 24 | edge [arrowtail=vee, dir=back]; 25 | v20120202storage -- v20110101storage; 26 | } -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-rolling-storage/2012-02-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-rolling-storage/2012-02-02.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-rolling-storage/2013-03-03.dot: -------------------------------------------------------------------------------- 1 | graph G { 2 | subgraph apiVersions { 3 | rank=same; 4 | label="API Versions"; 5 | labelloc=t 6 | 7 | node [shape=ellipse, group=api]; 8 | v20110101; 9 | v20120202; 10 | v20130303; 11 | } 12 | 13 | node [shape=ellipse, penwidth=3]; 14 | v20130303storage; 15 | 16 | subgraph storageVersions { 17 | rank=same; 18 | label="Storage Versions"; 19 | labelloc=b 20 | 21 | node [shape=ellipse, style=dashed, penwidth=1, rankType=min, group=storage]; 22 | v20110101storage; 23 | v20120202storage; 24 | } 25 | 26 | edge [arrowhead=vee, arrowtail=vee, dir=both]; 27 | v20110101 -- v20130303storage; 28 | v20120202 -- v20130303storage; 29 | v20130303 -- v20130303storage; 30 | 31 | edge [arrowtail=vee, dir=back]; 32 | v20130303storage -- v20110101storage; 33 | v20130303storage -- v20120202storage; 34 | } 35 | -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-rolling-storage/2013-03-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-rolling-storage/2013-03-03.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-rolling-storage/2014-04-04-preview.dot: -------------------------------------------------------------------------------- 1 | graph G { 2 | subgraph apiVersions { 3 | rank=same; 4 | label="API Versions"; 5 | labelloc=t 6 | 7 | node [shape=ellipse, group=api]; 8 | v20110101; 9 | v20120202; 10 | v20130303; 11 | v20140404preview; 12 | } 13 | 14 | node [shape=ellipse, penwidth=3]; 15 | v20130303storage; 16 | 17 | subgraph storageVersions { 18 | rank=same; 19 | label="Storage Versions"; 20 | labelloc=b 21 | 22 | node [shape=ellipse, style=dashed, penwidth=1, rankType=min, group=storage]; 23 | v20110101storage; 24 | v20120202storage; 25 | } 26 | 27 | edge [arrowhead=vee, arrowtail=vee, dir=both]; 28 | v20110101 -- v20130303storage; 29 | v20120202 -- v20130303storage; 30 | v20130303 -- v20130303storage; 31 | v20140404preview -- v20130303storage; 32 | 33 | edge [arrowtail=vee, dir=back]; 34 | v20130303storage -- v20110101storage; 35 | v20130303storage -- v20120202storage; 36 | } 37 | -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-rolling-storage/2014-04-04-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-rolling-storage/2014-04-04-preview.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-rolling-storage/2014-04-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-rolling-storage/2014-04-04.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-rolling-storage/2015-05-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-rolling-storage/2015-05-05.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-rolling-storage/2016-06-06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-rolling-storage/2016-06-06.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-rolling-storage/2017-07-07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-rolling-storage/2017-07-07.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-rolling-storage/2018-08-08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-rolling-storage/2018-08-08.png -------------------------------------------------------------------------------- /hack/generator/spec/images/case-study-rolling-storage/2019-09-09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/case-study-rolling-storage/2019-09-09.png -------------------------------------------------------------------------------- /hack/generator/spec/images/versioning/conversions.dot: -------------------------------------------------------------------------------- 1 | graph G { 2 | nodesep="1" 3 | 4 | subgraph apiVersions { 5 | rank=same; 6 | label="API Versions"; 7 | labelloc=t 8 | 9 | node [shape=ellipse, group=api]; 10 | v1; 11 | v2; 12 | v3; 13 | v4; 14 | } 15 | 16 | 17 | subgraph storageVersions { 18 | rank=same; 19 | 20 | node [shape=ellipse, rankType=min, group=storage]; 21 | v1storage; 22 | v2storage; 23 | v3storage; 24 | 25 | node [shape=ellipse, penwidth=3]; 26 | v4storage; 27 | } 28 | 29 | edge [arrowhead=vee, dir=forward]; 30 | v1 -- v1storage; 31 | v2 -- v2storage; 32 | v3 -- v3storage; 33 | v4 -- v4storage 34 | 35 | edge [arrowhead=vee, dir=forward]; 36 | v1storage -- v2storage; 37 | v2storage -- v3storage; 38 | v3storage -- v4storage; 39 | } 40 | -------------------------------------------------------------------------------- /hack/generator/spec/images/versioning/conversions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/versioning/conversions.png -------------------------------------------------------------------------------- /hack/generator/spec/images/versioning/direct-conversion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/versioning/direct-conversion.png -------------------------------------------------------------------------------- /hack/generator/spec/images/versioning/direct-conversion.seq: -------------------------------------------------------------------------------- 1 | # Sequence diagram from https://sequencediagram.org/ 2 | 3 | participant "Controller" as c 4 | participant "v4 v4.Person" as v 5 | participant "hub v4storage.Person" as s 6 | 7 | c -> v: v4.ConvertToStorage(hub) 8 | activate v 9 | v ->> s: (copy properties from v4 onto hub) 10 | c <-- v: return 11 | deactivate v 12 | -------------------------------------------------------------------------------- /hack/generator/spec/images/versioning/golden-tests-from-latest.dot: -------------------------------------------------------------------------------- 1 | graph G { 2 | node [shape=ellipse, group=api, rank=same]; 3 | v20180808; 4 | v20190909; 5 | 6 | node [shape=ellipse, penwidth=3]; 7 | v20190909storage; 8 | 9 | edge [arrowhead=vee, arrowtail=vee, dir=back]; 10 | v20180808 -- v20190909storage; 11 | v20190909storage -- v20190909 12 | } 13 | -------------------------------------------------------------------------------- /hack/generator/spec/images/versioning/golden-tests-from-latest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/versioning/golden-tests-from-latest.png -------------------------------------------------------------------------------- /hack/generator/spec/images/versioning/golden-tests-to-latest.dot: -------------------------------------------------------------------------------- 1 | graph G { 2 | node [shape=ellipse, group=api, rank=same]; 3 | v20180808; 4 | v20190909; 5 | 6 | node [shape=ellipse, penwidth=3]; 7 | v20190909storage; 8 | 9 | edge [arrowhead=vee, arrowtail=vee, dir=forward]; 10 | v20180808 -- v20190909storage; 11 | v20190909storage -- v20190909 12 | } 13 | -------------------------------------------------------------------------------- /hack/generator/spec/images/versioning/golden-tests-to-latest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/versioning/golden-tests-to-latest.png -------------------------------------------------------------------------------- /hack/generator/spec/images/versioning/multiple-step-conversion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/versioning/multiple-step-conversion.png -------------------------------------------------------------------------------- /hack/generator/spec/images/versioning/multiple-step-conversion.seq: -------------------------------------------------------------------------------- 1 | # Sequence diagram from https://sequencediagram.org/ 2 | 3 | participant "Controller" as c 4 | participant "v3 v3.Person" as v3 5 | participant "s3 v3storage.Person" as s3 6 | participant "hub v4storage.Person" as s4 7 | 8 | c -> v3: vs.ConvertToStorage(hub) 9 | activate v3 10 | v3 ->* s3: <> 11 | v3 -> s3: (copy properties from v3 onto s3) 12 | v3 -> s3: s3.ConvertToStorage(hub) 13 | activate s3 14 | s3 ->> s4: (copy properties from s3 to hub) 15 | v3 <-- s3: return 16 | deactivate s3 17 | c <-- v3: return 18 | deactivate v3 19 | -------------------------------------------------------------------------------- /hack/generator/spec/images/versioning/property-mapping-flowchart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/versioning/property-mapping-flowchart.png -------------------------------------------------------------------------------- /hack/generator/spec/images/versioning/two-step-conversion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/versioning/two-step-conversion.png -------------------------------------------------------------------------------- /hack/generator/spec/images/versioning/two-step-conversion.seq: -------------------------------------------------------------------------------- 1 | # Sequence diagram from https://sequencediagram.org/ 2 | 3 | participant "Controller" as c 4 | participant "v3 v3.Person" as v3 5 | participant "s3 v3storage.Person" as s3 6 | participant "hub v4storage.Person" as s4 7 | 8 | c -> v3: vs.ConvertToStorage(hub) 9 | activate v3 10 | v3 ->* s3: <> 11 | v3 -> s3: (copy properties from v3 onto s3) 12 | v3 -> s3: s3.ConvertToStorage(hub) 13 | activate s3 14 | s3 ->> s4: (copy properties from s3 to hub) 15 | v3 <-- s3: return 16 | deactivate s3 17 | c <-- v3: return 18 | deactivate v3 19 | -------------------------------------------------------------------------------- /hack/generator/spec/images/versioning/two-step-reverse-conversion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/k8s-infra/b66072047937301e919c4332d7cdd4493739718f/hack/generator/spec/images/versioning/two-step-reverse-conversion.png -------------------------------------------------------------------------------- /hack/generator/spec/images/versioning/two-step-reverse-conversion.seq: -------------------------------------------------------------------------------- 1 | # Sequence diagram from https://sequencediagram.org/ 2 | 3 | participant "Controller" as c 4 | participant "v3 v3.Person" as v3 5 | participant "s3 v3storage.Person" as s3 6 | participant "hub v4storage.Person" as s4 7 | 8 | c -> v3: vs.ConvertFromStorage(hub) 9 | activate v3 10 | v3 ->* s3: <> 11 | v3 -> s3: s3.ConvertFromStorage(hub) 12 | activate s3 13 | s4 ->> s3: (copy properties from hub to s3) 14 | v3 <-- s3: return 15 | deactivate s3 16 | s3 ->> v3: (copy properties from v3 onto s3) 17 | c <-- v3: return 18 | deactivate v3 19 | -------------------------------------------------------------------------------- /internal/test/test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package test 7 | 8 | import ( 9 | "math/rand" 10 | "time" 11 | ) 12 | 13 | var ( 14 | letterRunes = []rune("abcdefghijklmnopqrstuvwxyz123456789") 15 | ) 16 | 17 | func init() { 18 | rand.Seed(time.Now().Unix()) 19 | } 20 | 21 | // RandomName generates a random Event Hub name tagged with the suite id 22 | func RandomName(prefix string, length int) string { 23 | return RandomString(prefix, length) 24 | } 25 | 26 | // RandomString generates a random string with prefix 27 | func RandomString(prefix string, length int) string { 28 | b := make([]rune, length) 29 | for i := range b { 30 | b[i] = letterRunes[rand.Intn(len(letterRunes))] 31 | } 32 | return prefix + string(b) 33 | } 34 | -------------------------------------------------------------------------------- /pkg/util/ctrlutil/controller.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package ctrlutil 7 | 8 | import ( 9 | "github.com/pkg/errors" 10 | "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" 11 | ) 12 | 13 | // IsSucceeded returns true if the Status.ProvisioningState == Succeeded 14 | func IsSucceeded(obj *unstructured.Unstructured) (bool, error) { 15 | ready, found, err := unstructured.NestedString(obj.Object, "status", "provisioningState") 16 | if err != nil { 17 | return false, errors.Wrapf(err, "failed to determine %v %q readiness", 18 | obj.GroupVersionKind(), obj.GetName()) 19 | } 20 | return ready == "Succeeded" && found, nil 21 | } 22 | -------------------------------------------------------------------------------- /pkg/util/statusutil/status.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package statusutil 7 | 8 | import ( 9 | "fmt" 10 | 11 | "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" 12 | "k8s.io/apimachinery/pkg/runtime" 13 | ) 14 | 15 | func GetProvisioningState(obj runtime.Object) (string, error) { 16 | unObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj) 17 | if err != nil { 18 | return "", fmt.Errorf("unable to convert to unstructured with: %w", err) 19 | } 20 | 21 | status, _, err := unstructured.NestedString(unObj, "status", "provisioningState") 22 | if err != nil { 23 | return "", fmt.Errorf("unable to fetch nested string status with: %w", err) 24 | } 25 | 26 | return status, nil 27 | } 28 | -------------------------------------------------------------------------------- /pkg/zips/env.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation. 3 | Licensed under the MIT license. 4 | */ 5 | 6 | package zips 7 | 8 | import ( 9 | "os" 10 | ) 11 | 12 | type ( 13 | Enver interface { 14 | Getenv(key string) string 15 | } 16 | 17 | stdEnv struct{} 18 | ) 19 | 20 | // Getenv will return os.Getenv for a given key 21 | func (*stdEnv) Getenv(key string) string { 22 | return os.Getenv(key) 23 | } 24 | -------------------------------------------------------------------------------- /scripts/create_testing_creds.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright (c) Microsoft Corporation. 4 | # Licensed under the MIT license. 5 | 6 | set -o errexit 7 | set -o nounset 8 | set -o pipefail 9 | 10 | # Enable tracing in this script off by setting the TRACE variable in your 11 | # environment to any value: 12 | # 13 | # $ TRACE=1 test.sh 14 | TRACE=${TRACE:-""} 15 | if [[ -n "${TRACE}" ]]; then 16 | set -x 17 | fi 18 | 19 | REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. 20 | 21 | json=$(az ad sp create-for-rbac -o json) 22 | client_id=$(echo "$json" | jq -r '.appId') 23 | client_secret=$(echo "$json" | jq -r '.password') 24 | tenant_id=$(echo "$json" | jq -r '.tenant') 25 | subscription_id=$(az account show -o json | jq -r ".id") 26 | 27 | echo -e "AZURE_TENANT_ID=$tenant_id\nAZURE_CLIENT_ID=$client_id\nAZURE_CLIENT_SECRET=$client_secret\nAZURE_SUBSCRIPTION_ID=$subscription_id" > "$REPO_ROOT"/.env -------------------------------------------------------------------------------- /scripts/deploy_testing_secret.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright (c) Microsoft Corporation. 4 | # Licensed under the MIT license. 5 | 6 | set -o errexit 7 | set -o nounset 8 | set -o pipefail 9 | 10 | REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. 11 | 12 | bins="${REPO_ROOT}/hack/tools/bin" 13 | k="$bins/kubectl" 14 | 15 | cat <