diff --git a/apis/repo/v1alpha1/zz_generated.deepcopy.go b/apis/repo/v1alpha1/zz_generated.deepcopy.go index 0a42648..6f4435e 100644 --- a/apis/repo/v1alpha1/zz_generated.deepcopy.go +++ b/apis/repo/v1alpha1/zz_generated.deepcopy.go @@ -1479,6 +1479,11 @@ func (in *RepositoryParameters) DeepCopyInto(out *RepositoryParameters) { *out = new(string) **out = **in } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } if in.Pages != nil { in, out := &in.Pages, &out.Pages *out = make([]PagesParameters, len(*in)) diff --git a/apis/repo/v1alpha1/zz_repository_types.go b/apis/repo/v1alpha1/zz_repository_types.go index 6d545c9..9a96135 100755 --- a/apis/repo/v1alpha1/zz_repository_types.go +++ b/apis/repo/v1alpha1/zz_repository_types.go @@ -181,6 +181,10 @@ type RepositoryParameters struct { // +kubebuilder:validation:Optional MergeCommitTitle *string `json:"mergeCommitTitle,omitempty" tf:"merge_commit_title,omitempty"` + // The name of the repository. + // +kubebuilder:validation:Required + Name *string `json:"name" tf:"name,omitempty"` + // The repository's GitHub Pages configuration. See GitHub Pages Configuration below for details. // +kubebuilder:validation:Optional Pages []PagesParameters `json:"pages,omitempty" tf:"pages,omitempty"` diff --git a/config/external_name.go b/config/external_name.go index 20afdaf..c6f2a05 100644 --- a/config/external_name.go +++ b/config/external_name.go @@ -10,7 +10,7 @@ import "github.com/upbound/upjet/pkg/config" // provider. var ExternalNameConfigs = map[string]config.ExternalName{ // Imported by using the following format: {{name}} - "github_repository": config.NameAsIdentifier, + "github_repository": config.IdentifierFromProvider, // Imported by using the following format: {{ repository }}:{{ name }}:{{ source branch }} "github_branch": config.TemplatedStringAsIdentifier("branch", "{{ .parameters.repository }}:{{ .external_name }}:{{ .parameters.source_branch }}"), // Imported by using the following format: {{ repository }} diff --git a/examples-generated/repo/branchprotection.yaml b/examples-generated/repo/branchprotection.yaml index 36cca3e..df95b64 100644 --- a/examples-generated/repo/branchprotection.yaml +++ b/examples-generated/repo/branchprotection.yaml @@ -42,7 +42,8 @@ metadata: testing.upbound.io/example-name: example name: example spec: - forProvider: {} + forProvider: + name: test --- diff --git a/examples-generated/repo/defaultbranch.yaml b/examples-generated/repo/defaultbranch.yaml index 51925d0..59d0d91 100644 --- a/examples-generated/repo/defaultbranch.yaml +++ b/examples-generated/repo/defaultbranch.yaml @@ -42,6 +42,7 @@ spec: forProvider: autoInit: true description: My awesome codebase + name: example --- diff --git a/examples-generated/repo/repository.yaml b/examples-generated/repo/repository.yaml index 91d0e95..bc72a48 100644 --- a/examples-generated/repo/repository.yaml +++ b/examples-generated/repo/repository.yaml @@ -9,6 +9,7 @@ metadata: spec: forProvider: description: My awesome codebase + name: example template: - includeAllBranches: true owner: github diff --git a/examples-generated/repo/repositoryfile.yaml b/examples-generated/repo/repositoryfile.yaml index 4a2fae9..f5ca2f4 100644 --- a/examples-generated/repo/repositoryfile.yaml +++ b/examples-generated/repo/repositoryfile.yaml @@ -34,6 +34,7 @@ metadata: spec: forProvider: autoInit: true + name: tf-acc-test-%s --- diff --git a/examples-generated/team/teamrepository.yaml b/examples-generated/team/teamrepository.yaml index 6364490..331d7fb 100644 --- a/examples-generated/team/teamrepository.yaml +++ b/examples-generated/team/teamrepository.yaml @@ -27,7 +27,8 @@ metadata: testing.upbound.io/example-name: some_repo name: some-repo spec: - forProvider: {} + forProvider: + name: some-repo --- diff --git a/internal/controller/repo/repository/zz_controller.go b/internal/controller/repo/repository/zz_controller.go index 4b304b6..28c1033 100755 --- a/internal/controller/repo/repository/zz_controller.go +++ b/internal/controller/repo/repository/zz_controller.go @@ -25,7 +25,6 @@ import ( func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { name := managed.ControllerName(v1alpha1.Repository_GroupVersionKind.String()) var initializers managed.InitializerChain - initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) diff --git a/package/crds/repo.github.upbound.io_repositories.yaml b/package/crds/repo.github.upbound.io_repositories.yaml index 66256b3..3f0bbb1 100644 --- a/package/crds/repo.github.upbound.io_repositories.yaml +++ b/package/crds/repo.github.upbound.io_repositories.yaml @@ -161,6 +161,9 @@ spec: description: Can be PR_TITLE or MERGE_MESSAGE for a default merge commit title. type: string + name: + description: The name of the repository. + type: string pages: description: The repository's GitHub Pages configuration. See GitHub Pages Configuration below for details. @@ -310,6 +313,8 @@ spec: alerts have not been successfully tested on any GitHub Enterprise instance and may be unavailable in those settings.' type: boolean + required: + - name type: object providerConfigRef: default: