Remove unused conditions
[ZITADOPER-1]
This commit is contained in:
@@ -195,7 +195,7 @@ func (in *MachineUser) DeepCopyInto(out *MachineUser) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.Spec = in.Spec
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
}
|
||||
|
||||
@@ -253,6 +253,13 @@ func (in *MachineUserList) DeepCopyObject() runtime.Object {
|
||||
func (in *MachineUserSpec) DeepCopyInto(out *MachineUserSpec) {
|
||||
*out = *in
|
||||
out.OrganizationRef = in.OrganizationRef
|
||||
if in.UserGrants != nil {
|
||||
in, out := &in.UserGrants, &out.UserGrants
|
||||
*out = make([]UserGrant, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineUserSpec.
|
||||
@@ -713,6 +720,27 @@ func (in *SMTPConfig) DeepCopy() *SMTPConfig {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *UserGrant) DeepCopyInto(out *UserGrant) {
|
||||
*out = *in
|
||||
out.ProjectRef = in.ProjectRef
|
||||
if in.RoleKeys != nil {
|
||||
in, out := &in.RoleKeys, &out.RoleKeys
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserGrant.
|
||||
func (in *UserGrant) DeepCopy() *UserGrant {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(UserGrant)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ZitadelCluster) DeepCopyInto(out *ZitadelCluster) {
|
||||
*out = *in
|
||||
|
||||
@@ -369,6 +369,7 @@ func (wr *wrappedMachineUserReconciler) reconcileUserGrants(ctx context.Context,
|
||||
for _, existingGrantedProject := range grantedProjects.Result {
|
||||
if existingGrantedProject.ProjectId == userGrantedProject.Status.ProjectId {
|
||||
existingProjectGrant = existingGrantedProject
|
||||
break
|
||||
}
|
||||
}
|
||||
if existingProjectGrant == nil {
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
package conditions
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
)
|
||||
|
||||
type Conditioner interface {
|
||||
@@ -64,67 +59,6 @@ func (p *Ready) PatcherHealthy(err error) Patcher {
|
||||
}
|
||||
}
|
||||
|
||||
type Complete struct {
|
||||
client client.Client
|
||||
}
|
||||
|
||||
func NewComplete(client client.Client) *Complete {
|
||||
return &Complete{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Complete) PatcherFailed(msg string) Patcher {
|
||||
return func(c Conditioner) {
|
||||
SetCompleteFailedWithMessage(c, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Complete) PatcherWithCronJob(ctx context.Context, err error, key types.NamespacedName) (Patcher, error) {
|
||||
if err != nil {
|
||||
return func(c Conditioner) {
|
||||
SetCompleteFailedWithMessage(c, "Error creating CronJob")
|
||||
}, nil
|
||||
}
|
||||
|
||||
var cronJob batchv1.CronJob
|
||||
if err := p.client.Get(ctx, key, &cronJob); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return func(c Conditioner) {
|
||||
SetCompleteWithCronJob(c, &cronJob)
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (p *Complete) PatcherWithJob(ctx context.Context, err error, key types.NamespacedName) (Patcher, error) {
|
||||
if err != nil {
|
||||
return func(c Conditioner) {
|
||||
SetCompleteFailedWithMessage(c, "Error creating Job")
|
||||
}, nil
|
||||
}
|
||||
|
||||
var job batchv1.Job
|
||||
if err := p.client.Get(ctx, key, &job); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return func(c Conditioner) {
|
||||
SetCompleteWithJob(c, &job)
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (p *Complete) PatcherRefResolver(err error, obj runtime.Object) Patcher {
|
||||
return func(c Conditioner) {
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
if apierrors.IsNotFound(err) {
|
||||
SetCompleteFailedWithMessage(c, fmt.Sprintf("%s not found", getType(obj)))
|
||||
return
|
||||
}
|
||||
SetCompleteFailedWithMessage(c, fmt.Sprintf("Error getting %s", getType(obj)))
|
||||
}
|
||||
}
|
||||
|
||||
func getType(obj interface{}) string {
|
||||
if t := reflect.TypeOf(obj); t.Kind() == reflect.Ptr {
|
||||
return t.Elem().Name()
|
||||
|
||||
Reference in New Issue
Block a user