diff --git a/apis/actions/v1alpha1/zz_generated.conversion_hubs.go b/apis/actions/v1alpha1/zz_generated.conversion_hubs.go index 3e6fcf5..e187296 100755 --- a/apis/actions/v1alpha1/zz_generated.conversion_hubs.go +++ b/apis/actions/v1alpha1/zz_generated.conversion_hubs.go @@ -11,3 +11,6 @@ func (tr *ActionsSecret) Hub() {} // Hub marks this type as a conversion hub. func (tr *ActionsVariable) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RunnerGroup) Hub() {} diff --git a/apis/actions/v1alpha1/zz_generated.deepcopy.go b/apis/actions/v1alpha1/zz_generated.deepcopy.go index 224be6e..b5df59f 100644 --- a/apis/actions/v1alpha1/zz_generated.deepcopy.go +++ b/apis/actions/v1alpha1/zz_generated.deepcopy.go @@ -455,3 +455,318 @@ func (in *ActionsVariableStatus) DeepCopy() *ActionsVariableStatus { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RunnerGroup) DeepCopyInto(out *RunnerGroup) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunnerGroup. +func (in *RunnerGroup) DeepCopy() *RunnerGroup { + if in == nil { + return nil + } + out := new(RunnerGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RunnerGroup) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RunnerGroupInitParameters) DeepCopyInto(out *RunnerGroupInitParameters) { + *out = *in + if in.AllowsPublicRepositories != nil { + in, out := &in.AllowsPublicRepositories, &out.AllowsPublicRepositories + *out = new(bool) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.NameRef != nil { + in, out := &in.NameRef, &out.NameRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.NameSelector != nil { + in, out := &in.NameSelector, &out.NameSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } + if in.RestrictedToWorkflows != nil { + in, out := &in.RestrictedToWorkflows, &out.RestrictedToWorkflows + *out = new(bool) + **out = **in + } + if in.SelectedRepositoryIds != nil { + in, out := &in.SelectedRepositoryIds, &out.SelectedRepositoryIds + *out = make([]*int64, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(int64) + **out = **in + } + } + } + if in.SelectedWorkflows != nil { + in, out := &in.SelectedWorkflows, &out.SelectedWorkflows + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.Visibility != nil { + in, out := &in.Visibility, &out.Visibility + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunnerGroupInitParameters. +func (in *RunnerGroupInitParameters) DeepCopy() *RunnerGroupInitParameters { + if in == nil { + return nil + } + out := new(RunnerGroupInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RunnerGroupList) DeepCopyInto(out *RunnerGroupList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]RunnerGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunnerGroupList. +func (in *RunnerGroupList) DeepCopy() *RunnerGroupList { + if in == nil { + return nil + } + out := new(RunnerGroupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RunnerGroupList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RunnerGroupObservation) DeepCopyInto(out *RunnerGroupObservation) { + *out = *in + if in.AllowsPublicRepositories != nil { + in, out := &in.AllowsPublicRepositories, &out.AllowsPublicRepositories + *out = new(bool) + **out = **in + } + if in.Default != nil { + in, out := &in.Default, &out.Default + *out = new(bool) + **out = **in + } + if in.Etag != nil { + in, out := &in.Etag, &out.Etag + *out = new(string) + **out = **in + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.Inherited != nil { + in, out := &in.Inherited, &out.Inherited + *out = new(bool) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.RestrictedToWorkflows != nil { + in, out := &in.RestrictedToWorkflows, &out.RestrictedToWorkflows + *out = new(bool) + **out = **in + } + if in.RunnersURL != nil { + in, out := &in.RunnersURL, &out.RunnersURL + *out = new(string) + **out = **in + } + if in.SelectedRepositoriesURL != nil { + in, out := &in.SelectedRepositoriesURL, &out.SelectedRepositoriesURL + *out = new(string) + **out = **in + } + if in.SelectedRepositoryIds != nil { + in, out := &in.SelectedRepositoryIds, &out.SelectedRepositoryIds + *out = make([]*int64, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(int64) + **out = **in + } + } + } + if in.SelectedWorkflows != nil { + in, out := &in.SelectedWorkflows, &out.SelectedWorkflows + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.Visibility != nil { + in, out := &in.Visibility, &out.Visibility + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunnerGroupObservation. +func (in *RunnerGroupObservation) DeepCopy() *RunnerGroupObservation { + if in == nil { + return nil + } + out := new(RunnerGroupObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RunnerGroupParameters) DeepCopyInto(out *RunnerGroupParameters) { + *out = *in + if in.AllowsPublicRepositories != nil { + in, out := &in.AllowsPublicRepositories, &out.AllowsPublicRepositories + *out = new(bool) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.NameRef != nil { + in, out := &in.NameRef, &out.NameRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.NameSelector != nil { + in, out := &in.NameSelector, &out.NameSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } + if in.RestrictedToWorkflows != nil { + in, out := &in.RestrictedToWorkflows, &out.RestrictedToWorkflows + *out = new(bool) + **out = **in + } + if in.SelectedRepositoryIds != nil { + in, out := &in.SelectedRepositoryIds, &out.SelectedRepositoryIds + *out = make([]*int64, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(int64) + **out = **in + } + } + } + if in.SelectedWorkflows != nil { + in, out := &in.SelectedWorkflows, &out.SelectedWorkflows + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.Visibility != nil { + in, out := &in.Visibility, &out.Visibility + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunnerGroupParameters. +func (in *RunnerGroupParameters) DeepCopy() *RunnerGroupParameters { + if in == nil { + return nil + } + out := new(RunnerGroupParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RunnerGroupSpec) DeepCopyInto(out *RunnerGroupSpec) { + *out = *in + in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ForProvider.DeepCopyInto(&out.ForProvider) + in.InitProvider.DeepCopyInto(&out.InitProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunnerGroupSpec. +func (in *RunnerGroupSpec) DeepCopy() *RunnerGroupSpec { + if in == nil { + return nil + } + out := new(RunnerGroupSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RunnerGroupStatus) DeepCopyInto(out *RunnerGroupStatus) { + *out = *in + in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) + in.AtProvider.DeepCopyInto(&out.AtProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunnerGroupStatus. +func (in *RunnerGroupStatus) DeepCopy() *RunnerGroupStatus { + if in == nil { + return nil + } + out := new(RunnerGroupStatus) + in.DeepCopyInto(out) + return out +} diff --git a/apis/actions/v1alpha1/zz_generated.managed.go b/apis/actions/v1alpha1/zz_generated.managed.go index 74fbee4..7655eca 100644 --- a/apis/actions/v1alpha1/zz_generated.managed.go +++ b/apis/actions/v1alpha1/zz_generated.managed.go @@ -126,3 +126,63 @@ func (mg *ActionsVariable) SetPublishConnectionDetailsTo(r *xpv1.PublishConnecti func (mg *ActionsVariable) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { mg.Spec.WriteConnectionSecretToReference = r } + +// GetCondition of this RunnerGroup. +func (mg *RunnerGroup) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this RunnerGroup. +func (mg *RunnerGroup) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetManagementPolicies of this RunnerGroup. +func (mg *RunnerGroup) GetManagementPolicies() xpv1.ManagementPolicies { + return mg.Spec.ManagementPolicies +} + +// GetProviderConfigReference of this RunnerGroup. +func (mg *RunnerGroup) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +// GetPublishConnectionDetailsTo of this RunnerGroup. +func (mg *RunnerGroup) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { + return mg.Spec.PublishConnectionDetailsTo +} + +// GetWriteConnectionSecretToReference of this RunnerGroup. +func (mg *RunnerGroup) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this RunnerGroup. +func (mg *RunnerGroup) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this RunnerGroup. +func (mg *RunnerGroup) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetManagementPolicies of this RunnerGroup. +func (mg *RunnerGroup) SetManagementPolicies(r xpv1.ManagementPolicies) { + mg.Spec.ManagementPolicies = r +} + +// SetProviderConfigReference of this RunnerGroup. +func (mg *RunnerGroup) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +// SetPublishConnectionDetailsTo of this RunnerGroup. +func (mg *RunnerGroup) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { + mg.Spec.PublishConnectionDetailsTo = r +} + +// SetWriteConnectionSecretToReference of this RunnerGroup. +func (mg *RunnerGroup) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} diff --git a/apis/actions/v1alpha1/zz_generated.managedlist.go b/apis/actions/v1alpha1/zz_generated.managedlist.go index 6603878..f31ce97 100644 --- a/apis/actions/v1alpha1/zz_generated.managedlist.go +++ b/apis/actions/v1alpha1/zz_generated.managedlist.go @@ -24,3 +24,12 @@ func (l *ActionsVariableList) GetItems() []resource.Managed { } return items } + +// GetItems of this RunnerGroupList. +func (l *RunnerGroupList) GetItems() []resource.Managed { + items := make([]resource.Managed, len(l.Items)) + for i := range l.Items { + items[i] = &l.Items[i] + } + return items +} diff --git a/apis/actions/v1alpha1/zz_generated.resolvers.go b/apis/actions/v1alpha1/zz_generated.resolvers.go index d72856f..5c7d18b 100644 --- a/apis/actions/v1alpha1/zz_generated.resolvers.go +++ b/apis/actions/v1alpha1/zz_generated.resolvers.go @@ -9,6 +9,7 @@ import ( "context" v1alpha1 "github.com/crossplane-contrib/provider-upjet-github/apis/repo/v1alpha1" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -96,3 +97,45 @@ func (mg *ActionsVariable) ResolveReferences(ctx context.Context, c client.Reade return nil } + +// ResolveReferences of this RunnerGroup. +func (mg *RunnerGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + r := reference.NewAPIResolver(c, mg) + + var rsp reference.ResolutionResponse + var err error + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Name), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.ForProvider.NameRef, + Selector: mg.Spec.ForProvider.NameSelector, + To: reference.To{ + List: &v1alpha1.RepositoryList{}, + Managed: &v1alpha1.Repository{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.Name") + } + mg.Spec.ForProvider.Name = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.NameRef = rsp.ResolvedReference + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Name), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.InitProvider.NameRef, + Selector: mg.Spec.InitProvider.NameSelector, + To: reference.To{ + List: &v1alpha1.RepositoryList{}, + Managed: &v1alpha1.Repository{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.Name") + } + mg.Spec.InitProvider.Name = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.InitProvider.NameRef = rsp.ResolvedReference + + return nil +} diff --git a/apis/actions/v1alpha1/zz_runnergroup_terraformed.go b/apis/actions/v1alpha1/zz_runnergroup_terraformed.go new file mode 100755 index 0000000..9ab6f5f --- /dev/null +++ b/apis/actions/v1alpha1/zz_runnergroup_terraformed.go @@ -0,0 +1,129 @@ +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1alpha1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RunnerGroup +func (mg *RunnerGroup) GetTerraformResourceType() string { + return "github_actions_runner_group" +} + +// GetConnectionDetailsMapping for this RunnerGroup +func (tr *RunnerGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RunnerGroup +func (tr *RunnerGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RunnerGroup +func (tr *RunnerGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RunnerGroup +func (tr *RunnerGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RunnerGroup +func (tr *RunnerGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RunnerGroup +func (tr *RunnerGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RunnerGroup +func (tr *RunnerGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RunnerGroup +func (tr *RunnerGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RunnerGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RunnerGroup) LateInitialize(attrs []byte) (bool, error) { + params := &RunnerGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RunnerGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/actions/v1alpha1/zz_runnergroup_types.go b/apis/actions/v1alpha1/zz_runnergroup_types.go new file mode 100755 index 0000000..9d2cd56 --- /dev/null +++ b/apis/actions/v1alpha1/zz_runnergroup_types.go @@ -0,0 +1,208 @@ +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + + v1 "github.com/crossplane/crossplane-runtime/apis/common/v1" +) + +type RunnerGroupInitParameters struct { + + // Whether public repositories can be added to the runner group. Defaults to false. + // Whether public repositories can be added to the runner group. + AllowsPublicRepositories *bool `json:"allowsPublicRepositories,omitempty" tf:"allows_public_repositories,omitempty"` + + // Name of the runner group + // Name of the runner group. + // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-upjet-github/apis/repo/v1alpha1.Repository + // +crossplane:generate:reference:extractor=github.com/crossplane/upjet/pkg/resource.ExtractParamPath("name",false) + Name *string `json:"name,omitempty" tf:"name,omitempty"` + + // Reference to a Repository in repo to populate name. + // +kubebuilder:validation:Optional + NameRef *v1.Reference `json:"nameRef,omitempty" tf:"-"` + + // Selector for a Repository in repo to populate name. + // +kubebuilder:validation:Optional + NameSelector *v1.Selector `json:"nameSelector,omitempty" tf:"-"` + + // If true, the runner group will be restricted to running only the workflows specified in the selected_workflows array. Defaults to false. + // If 'true', the runner group will be restricted to running only the workflows specified in the 'selected_workflows' array. Defaults to 'false'. + RestrictedToWorkflows *bool `json:"restrictedToWorkflows,omitempty" tf:"restricted_to_workflows,omitempty"` + + // IDs of the repositories which should be added to the runner group + // List of repository IDs that can access the runner group. + // +listType=set + SelectedRepositoryIds []*int64 `json:"selectedRepositoryIds,omitempty" tf:"selected_repository_ids,omitempty"` + + // List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to true. + // List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to 'true'. + SelectedWorkflows []*string `json:"selectedWorkflows,omitempty" tf:"selected_workflows,omitempty"` + + // Visibility of a runner group. Whether the runner group can include all, selected, or private repositories. A value of private is not currently supported due to limitations in the GitHub API. + // The visibility of the runner group. + Visibility *string `json:"visibility,omitempty" tf:"visibility,omitempty"` +} + +type RunnerGroupObservation struct { + + // Whether public repositories can be added to the runner group. Defaults to false. + // Whether public repositories can be added to the runner group. + AllowsPublicRepositories *bool `json:"allowsPublicRepositories,omitempty" tf:"allows_public_repositories,omitempty"` + + // Whether this is the default runner group + // Whether this is the default runner group. + Default *bool `json:"default,omitempty" tf:"default,omitempty"` + + // An etag representing the runner group object + // An etag representing the runner group object + Etag *string `json:"etag,omitempty" tf:"etag,omitempty"` + + ID *string `json:"id,omitempty" tf:"id,omitempty"` + + // Whether the runner group is inherited from the enterprise level + // Whether the runner group is inherited from the enterprise level + Inherited *bool `json:"inherited,omitempty" tf:"inherited,omitempty"` + + // Name of the runner group + // Name of the runner group. + Name *string `json:"name,omitempty" tf:"name,omitempty"` + + // If true, the runner group will be restricted to running only the workflows specified in the selected_workflows array. Defaults to false. + // If 'true', the runner group will be restricted to running only the workflows specified in the 'selected_workflows' array. Defaults to 'false'. + RestrictedToWorkflows *bool `json:"restrictedToWorkflows,omitempty" tf:"restricted_to_workflows,omitempty"` + + // The GitHub API URL for the runner group's runners + // The GitHub API URL for the runner group's runners. + RunnersURL *string `json:"runnersUrl,omitempty" tf:"runners_url,omitempty"` + + // GitHub API URL for the runner group's repositories + // GitHub API URL for the runner group's repositories. + SelectedRepositoriesURL *string `json:"selectedRepositoriesUrl,omitempty" tf:"selected_repositories_url,omitempty"` + + // IDs of the repositories which should be added to the runner group + // List of repository IDs that can access the runner group. + // +listType=set + SelectedRepositoryIds []*int64 `json:"selectedRepositoryIds,omitempty" tf:"selected_repository_ids,omitempty"` + + // List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to true. + // List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to 'true'. + SelectedWorkflows []*string `json:"selectedWorkflows,omitempty" tf:"selected_workflows,omitempty"` + + // Visibility of a runner group. Whether the runner group can include all, selected, or private repositories. A value of private is not currently supported due to limitations in the GitHub API. + // The visibility of the runner group. + Visibility *string `json:"visibility,omitempty" tf:"visibility,omitempty"` +} + +type RunnerGroupParameters struct { + + // Whether public repositories can be added to the runner group. Defaults to false. + // Whether public repositories can be added to the runner group. + // +kubebuilder:validation:Optional + AllowsPublicRepositories *bool `json:"allowsPublicRepositories,omitempty" tf:"allows_public_repositories,omitempty"` + + // Name of the runner group + // Name of the runner group. + // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-upjet-github/apis/repo/v1alpha1.Repository + // +crossplane:generate:reference:extractor=github.com/crossplane/upjet/pkg/resource.ExtractParamPath("name",false) + // +kubebuilder:validation:Optional + Name *string `json:"name,omitempty" tf:"name,omitempty"` + + // Reference to a Repository in repo to populate name. + // +kubebuilder:validation:Optional + NameRef *v1.Reference `json:"nameRef,omitempty" tf:"-"` + + // Selector for a Repository in repo to populate name. + // +kubebuilder:validation:Optional + NameSelector *v1.Selector `json:"nameSelector,omitempty" tf:"-"` + + // If true, the runner group will be restricted to running only the workflows specified in the selected_workflows array. Defaults to false. + // If 'true', the runner group will be restricted to running only the workflows specified in the 'selected_workflows' array. Defaults to 'false'. + // +kubebuilder:validation:Optional + RestrictedToWorkflows *bool `json:"restrictedToWorkflows,omitempty" tf:"restricted_to_workflows,omitempty"` + + // IDs of the repositories which should be added to the runner group + // List of repository IDs that can access the runner group. + // +kubebuilder:validation:Optional + // +listType=set + SelectedRepositoryIds []*int64 `json:"selectedRepositoryIds,omitempty" tf:"selected_repository_ids,omitempty"` + + // List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to true. + // List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to 'true'. + // +kubebuilder:validation:Optional + SelectedWorkflows []*string `json:"selectedWorkflows,omitempty" tf:"selected_workflows,omitempty"` + + // Visibility of a runner group. Whether the runner group can include all, selected, or private repositories. A value of private is not currently supported due to limitations in the GitHub API. + // The visibility of the runner group. + // +kubebuilder:validation:Optional + Visibility *string `json:"visibility,omitempty" tf:"visibility,omitempty"` +} + +// RunnerGroupSpec defines the desired state of RunnerGroup +type RunnerGroupSpec struct { + v1.ResourceSpec `json:",inline"` + ForProvider RunnerGroupParameters `json:"forProvider"` + // THIS IS A BETA FIELD. It will be honored + // unless the Management Policies feature flag is disabled. + // InitProvider holds the same fields as ForProvider, with the exception + // of Identifier and other resource reference fields. The fields that are + // in InitProvider are merged into ForProvider when the resource is created. + // The same fields are also added to the terraform ignore_changes hook, to + // avoid updating them after creation. This is useful for fields that are + // required on creation, but we do not desire to update them after creation, + // for example because of an external controller is managing them, like an + // autoscaler. + InitProvider RunnerGroupInitParameters `json:"initProvider,omitempty"` +} + +// RunnerGroupStatus defines the observed state of RunnerGroup. +type RunnerGroupStatus struct { + v1.ResourceStatus `json:",inline"` + AtProvider RunnerGroupObservation `json:"atProvider,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion + +// RunnerGroup is the Schema for the RunnerGroups API. Creates and manages an Actions Runner Group within a GitHub organization +// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" +// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,github} +type RunnerGroup struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.visibility) || (has(self.initProvider) && has(self.initProvider.visibility))",message="spec.forProvider.visibility is a required parameter" + Spec RunnerGroupSpec `json:"spec"` + Status RunnerGroupStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// RunnerGroupList contains a list of RunnerGroups +type RunnerGroupList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []RunnerGroup `json:"items"` +} + +// Repository type metadata. +var ( + RunnerGroup_Kind = "RunnerGroup" + RunnerGroup_GroupKind = schema.GroupKind{Group: CRDGroup, Kind: RunnerGroup_Kind}.String() + RunnerGroup_KindAPIVersion = RunnerGroup_Kind + "." + CRDGroupVersion.String() + RunnerGroup_GroupVersionKind = CRDGroupVersion.WithKind(RunnerGroup_Kind) +) + +func init() { + SchemeBuilder.Register(&RunnerGroup{}, &RunnerGroupList{}) +} diff --git a/config/actions/config.go b/config/actions/config.go new file mode 100644 index 0000000..89cf9ce --- /dev/null +++ b/config/actions/config.go @@ -0,0 +1,12 @@ +package actions + +import "github.com/crossplane/upjet/pkg/config" + +// Configure github_actions_secret resource. +func Configure(p *config.Provider) { + p.AddResourceConfigurator("github_actions_runner_group", func(r *config.Resource) { + + r.ShortGroup = "actions" + //TODO: implemant an array of references + }) +} diff --git a/config/external_name.go b/config/external_name.go index cfea638..6c378b8 100644 --- a/config/external_name.go +++ b/config/external_name.go @@ -55,6 +55,8 @@ var terraformPluginSDKExternalNameConfigs = map[string]config.ExternalName{ "github_repository_collaborator": config.IdentifierFromProvider, // Can be imported using the following format: {{ repository }}:{{ environment }} "github_repository_environment": config.IdentifierFromProvider, + // Can be imported using the following format: {{ runner id }} + "github_actions_runner_group": config.IdentifierFromProvider, } // cliReconciledExternalNameConfigs contains all external name configurations diff --git a/config/provider.go b/config/provider.go index 627ead7..0ef4e5d 100644 --- a/config/provider.go +++ b/config/provider.go @@ -9,6 +9,7 @@ import ( // Note(ezgidemirel): we are importing this to embed provider schema document _ "embed" + "github.com/crossplane-contrib/provider-upjet-github/config/actions" "github.com/crossplane-contrib/provider-upjet-github/config/actionssecret" "github.com/crossplane-contrib/provider-upjet-github/config/actionsvariable" "github.com/crossplane-contrib/provider-upjet-github/config/branch" @@ -76,6 +77,7 @@ func GetProvider(ctx context.Context) (*ujconfig.Provider, error) { branchprotection.Configure, repositorywebhook.Configure, actionssecret.Configure, + actions.Configure, actionsvariable.Configure, organization.Configure, organizationruleset.Configure, diff --git a/examples-generated/actions/v1alpha1/runnergroup.yaml b/examples-generated/actions/v1alpha1/runnergroup.yaml new file mode 100644 index 0000000..79313c9 --- /dev/null +++ b/examples-generated/actions/v1alpha1/runnergroup.yaml @@ -0,0 +1,30 @@ +apiVersion: actions.github.upbound.io/v1alpha1 +kind: RunnerGroup +metadata: + annotations: + meta.upbound.io/example-id: actions/v1alpha1/runnergroup + labels: + testing.upbound.io/example-name: example + name: example +spec: + forProvider: + nameSelector: + matchLabels: + testing.upbound.io/example-name: example + selectedRepositoryIds: + - ${github_repository.example.repo_id} + visibility: selected + +--- + +apiVersion: repo.github.upbound.io/v1alpha1 +kind: Repository +metadata: + annotations: + meta.upbound.io/example-id: actions/v1alpha1/runnergroup + labels: + testing.upbound.io/example-name: example + name: example +spec: + forProvider: + name: my-repository diff --git a/internal/controller/actions/runnergroup/zz_controller.go b/internal/controller/actions/runnergroup/zz_controller.go new file mode 100755 index 0000000..323a8d6 --- /dev/null +++ b/internal/controller/actions/runnergroup/zz_controller.go @@ -0,0 +1,91 @@ +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package runnergroup + +import ( + "time" + + "github.com/crossplane/crossplane-runtime/pkg/connection" + "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" + tjcontroller "github.com/crossplane/upjet/pkg/controller" + "github.com/crossplane/upjet/pkg/controller/handler" + "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" + ctrl "sigs.k8s.io/controller-runtime" + + v1alpha1 "github.com/crossplane-contrib/provider-upjet-github/apis/actions/v1alpha1" + features "github.com/crossplane-contrib/provider-upjet-github/internal/features" +) + +// Setup adds a controller that reconciles RunnerGroup managed resources. +func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { + name := managed.ControllerName(v1alpha1.RunnerGroup_GroupVersionKind.String()) + var initializers managed.InitializerChain + cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} + if o.SecretStoreConfigGVK != nil { + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) + } + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1alpha1.RunnerGroup_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1alpha1.RunnerGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) + opts := []managed.ReconcilerOption{ + managed.WithExternalConnecter( + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["github_actions_runner_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1alpha1.RunnerGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + managed.WithLogger(o.Logger.WithValues("controller", name)), + managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithTimeout(3 * time.Minute), + managed.WithInitializers(initializers), + managed.WithConnectionPublishers(cps...), + managed.WithPollInterval(o.PollInterval), + } + if o.PollJitter != 0 { + opts = append(opts, managed.WithPollJitterHook(o.PollJitter)) + } + if o.Features.Enabled(features.EnableBetaManagementPolicies) { + opts = append(opts, managed.WithManagementPolicies()) + } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } + + // register webhooks for the kind v1alpha1.RunnerGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1alpha1.RunnerGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1alpha1.RunnerGroup") + } + } + + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1alpha1.RunnerGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1alpha1.RunnerGroupList") + } + } + + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1alpha1.RunnerGroup_GroupVersionKind), opts...) + + return ctrl.NewControllerManagedBy(mgr). + Named(name). + WithOptions(o.ForControllerRuntime()). + WithEventFilter(xpresource.DesiredStateChanged()). + Watches(&v1alpha1.RunnerGroup{}, eventHandler). + Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) +} diff --git a/internal/controller/zz_setup.go b/internal/controller/zz_setup.go index e16d420..bc52995 100755 --- a/internal/controller/zz_setup.go +++ b/internal/controller/zz_setup.go @@ -11,6 +11,7 @@ import ( actionssecret "github.com/crossplane-contrib/provider-upjet-github/internal/controller/actions/actionssecret" actionsvariable "github.com/crossplane-contrib/provider-upjet-github/internal/controller/actions/actionsvariable" + runnergroup "github.com/crossplane-contrib/provider-upjet-github/internal/controller/actions/runnergroup" organization "github.com/crossplane-contrib/provider-upjet-github/internal/controller/enterprise/organization" organizationruleset "github.com/crossplane-contrib/provider-upjet-github/internal/controller/enterprise/organizationruleset" providerconfig "github.com/crossplane-contrib/provider-upjet-github/internal/controller/providerconfig" @@ -40,6 +41,7 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { for _, setup := range []func(ctrl.Manager, controller.Options) error{ actionssecret.Setup, actionsvariable.Setup, + runnergroup.Setup, organization.Setup, organizationruleset.Setup, providerconfig.Setup, diff --git a/package/crds/actions.github.upbound.io_runnergroups.yaml b/package/crds/actions.github.upbound.io_runnergroups.yaml new file mode 100644 index 0000000..b91808e --- /dev/null +++ b/package/crds/actions.github.upbound.io_runnergroups.yaml @@ -0,0 +1,612 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: runnergroups.actions.github.upbound.io +spec: + group: actions.github.upbound.io + names: + categories: + - crossplane + - managed + - github + kind: RunnerGroup + listKind: RunnerGroupList + plural: runnergroups + singular: runnergroup + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Synced')].status + name: SYNCED + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: READY + type: string + - jsonPath: .metadata.annotations.crossplane\.io/external-name + name: EXTERNAL-NAME + type: string + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: RunnerGroup is the Schema for the RunnerGroups API. Creates and + manages an Actions Runner Group within a GitHub organization + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: RunnerGroupSpec defines the desired state of RunnerGroup + properties: + deletionPolicy: + default: Delete + description: |- + DeletionPolicy specifies what will happen to the underlying external + when this managed resource is deleted - either "Delete" or "Orphan" the + external resource. + This field is planned to be deprecated in favor of the ManagementPolicies + field in a future release. Currently, both could be set independently and + non-default values would be honored if the feature flag is enabled. + See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 + enum: + - Orphan + - Delete + type: string + forProvider: + properties: + allowsPublicRepositories: + description: |- + Whether public repositories can be added to the runner group. Defaults to false. + Whether public repositories can be added to the runner group. + type: boolean + name: + description: |- + Name of the runner group + Name of the runner group. + type: string + nameRef: + description: Reference to a Repository in repo to populate name. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + nameSelector: + description: Selector for a Repository in repo to populate name. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object + restrictedToWorkflows: + description: |- + If true, the runner group will be restricted to running only the workflows specified in the selected_workflows array. Defaults to false. + If 'true', the runner group will be restricted to running only the workflows specified in the 'selected_workflows' array. Defaults to 'false'. + type: boolean + selectedRepositoryIds: + description: |- + IDs of the repositories which should be added to the runner group + List of repository IDs that can access the runner group. + items: + format: int64 + type: integer + type: array + x-kubernetes-list-type: set + selectedWorkflows: + description: |- + List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to true. + List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to 'true'. + items: + type: string + type: array + visibility: + description: |- + Visibility of a runner group. Whether the runner group can include all, selected, or private repositories. A value of private is not currently supported due to limitations in the GitHub API. + The visibility of the runner group. + type: string + type: object + initProvider: + description: |- + THIS IS A BETA FIELD. It will be honored + unless the Management Policies feature flag is disabled. + InitProvider holds the same fields as ForProvider, with the exception + of Identifier and other resource reference fields. The fields that are + in InitProvider are merged into ForProvider when the resource is created. + The same fields are also added to the terraform ignore_changes hook, to + avoid updating them after creation. This is useful for fields that are + required on creation, but we do not desire to update them after creation, + for example because of an external controller is managing them, like an + autoscaler. + properties: + allowsPublicRepositories: + description: |- + Whether public repositories can be added to the runner group. Defaults to false. + Whether public repositories can be added to the runner group. + type: boolean + name: + description: |- + Name of the runner group + Name of the runner group. + type: string + nameRef: + description: Reference to a Repository in repo to populate name. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + nameSelector: + description: Selector for a Repository in repo to populate name. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object + restrictedToWorkflows: + description: |- + If true, the runner group will be restricted to running only the workflows specified in the selected_workflows array. Defaults to false. + If 'true', the runner group will be restricted to running only the workflows specified in the 'selected_workflows' array. Defaults to 'false'. + type: boolean + selectedRepositoryIds: + description: |- + IDs of the repositories which should be added to the runner group + List of repository IDs that can access the runner group. + items: + format: int64 + type: integer + type: array + x-kubernetes-list-type: set + selectedWorkflows: + description: |- + List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to true. + List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to 'true'. + items: + type: string + type: array + visibility: + description: |- + Visibility of a runner group. Whether the runner group can include all, selected, or private repositories. A value of private is not currently supported due to limitations in the GitHub API. + The visibility of the runner group. + type: string + type: object + managementPolicies: + default: + - '*' + description: |- + THIS IS A BETA FIELD. It is on by default but can be opted out + through a Crossplane feature flag. + ManagementPolicies specify the array of actions Crossplane is allowed to + take on the managed and external resources. + This field is planned to replace the DeletionPolicy field in a future + release. Currently, both could be set independently and non-default + values would be honored if the feature flag is enabled. If both are + custom, the DeletionPolicy field will be ignored. + See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 + and this one: https://github.com/crossplane/crossplane/blob/444267e84783136daa93568b364a5f01228cacbe/design/one-pager-ignore-changes.md + items: + description: |- + A ManagementAction represents an action that the Crossplane controllers + can take on an external resource. + enum: + - Observe + - Create + - Update + - Delete + - LateInitialize + - '*' + type: string + type: array + providerConfigRef: + default: + name: default + description: |- + ProviderConfigReference specifies how the provider that will be used to + create, observe, update, and delete this managed resource should be + configured. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + publishConnectionDetailsTo: + description: |- + PublishConnectionDetailsTo specifies the connection secret config which + contains a name, metadata and a reference to secret store config to + which any connection details for this managed resource should be written. + Connection details frequently include the endpoint, username, + and password required to connect to the managed resource. + properties: + configRef: + default: + name: default + description: |- + SecretStoreConfigRef specifies which secret store config should be used + for this ConnectionSecret. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + metadata: + description: Metadata is the metadata for connection secret. + properties: + annotations: + additionalProperties: + type: string + description: |- + Annotations are the annotations to be added to connection secret. + - For Kubernetes secrets, this will be used as "metadata.annotations". + - It is up to Secret Store implementation for others store types. + type: object + labels: + additionalProperties: + type: string + description: |- + Labels are the labels/tags to be added to connection secret. + - For Kubernetes secrets, this will be used as "metadata.labels". + - It is up to Secret Store implementation for others store types. + type: object + type: + description: |- + Type is the SecretType for the connection secret. + - Only valid for Kubernetes Secret Stores. + type: string + type: object + name: + description: Name is the name of the connection secret. + type: string + required: + - name + type: object + writeConnectionSecretToRef: + description: |- + WriteConnectionSecretToReference specifies the namespace and name of a + Secret to which any connection details for this managed resource should + be written. Connection details frequently include the endpoint, username, + and password required to connect to the managed resource. + This field is planned to be replaced in a future release in favor of + PublishConnectionDetailsTo. Currently, both could be set independently + and connection details would be published to both without affecting + each other. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + - namespace + type: object + required: + - forProvider + type: object + x-kubernetes-validations: + - message: spec.forProvider.visibility is a required parameter + rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies + || ''Update'' in self.managementPolicies) || has(self.forProvider.visibility) + || (has(self.initProvider) && has(self.initProvider.visibility))' + status: + description: RunnerGroupStatus defines the observed state of RunnerGroup. + properties: + atProvider: + properties: + allowsPublicRepositories: + description: |- + Whether public repositories can be added to the runner group. Defaults to false. + Whether public repositories can be added to the runner group. + type: boolean + default: + description: |- + Whether this is the default runner group + Whether this is the default runner group. + type: boolean + etag: + description: |- + An etag representing the runner group object + An etag representing the runner group object + type: string + id: + type: string + inherited: + description: |- + Whether the runner group is inherited from the enterprise level + Whether the runner group is inherited from the enterprise level + type: boolean + name: + description: |- + Name of the runner group + Name of the runner group. + type: string + restrictedToWorkflows: + description: |- + If true, the runner group will be restricted to running only the workflows specified in the selected_workflows array. Defaults to false. + If 'true', the runner group will be restricted to running only the workflows specified in the 'selected_workflows' array. Defaults to 'false'. + type: boolean + runnersUrl: + description: |- + The GitHub API URL for the runner group's runners + The GitHub API URL for the runner group's runners. + type: string + selectedRepositoriesUrl: + description: |- + GitHub API URL for the runner group's repositories + GitHub API URL for the runner group's repositories. + type: string + selectedRepositoryIds: + description: |- + IDs of the repositories which should be added to the runner group + List of repository IDs that can access the runner group. + items: + format: int64 + type: integer + type: array + x-kubernetes-list-type: set + selectedWorkflows: + description: |- + List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to true. + List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to 'true'. + items: + type: string + type: array + visibility: + description: |- + Visibility of a runner group. Whether the runner group can include all, selected, or private repositories. A value of private is not currently supported due to limitations in the GitHub API. + The visibility of the runner group. + type: string + type: object + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: |- + LastTransitionTime is the last time this condition transitioned from one + status to another. + format: date-time + type: string + message: + description: |- + A Message containing details about this condition's last transition from + one status to another, if any. + type: string + observedGeneration: + description: |- + ObservedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + type: integer + reason: + description: A Reason for this condition's last transition from + one status to another. + type: string + status: + description: Status of this condition; is it currently True, + False, or Unknown? + type: string + type: + description: |- + Type of this condition. At most one of each condition type may apply to + a resource at any point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + observedGeneration: + description: |- + ObservedGeneration is the latest metadata.generation + which resulted in either a ready state, or stalled due to error + it can not recover from without human intervention. + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {}