mirror of
https://github.com/tinyauthapp/tinyauth.git
synced 2026-09-25 12:23:33 +08:00
feat: watch for both ingresses and tinyauth crds
This commit is contained in:
@@ -6,23 +6,11 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ApplicationSet is a list of Application resources
|
||||
type ApplicationSet struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
|
||||
Items []Application `json:"items"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// Application is a set of access control rules that can be applied to a
|
||||
// specific domain. It is an alternative to environment variable or config-based
|
||||
// access controls.
|
||||
type Application struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ApplicationSpec `json:"spec,omitempty"`
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"github.com/tinyauthapp/tinyauth/internal/model"
|
||||
)
|
||||
|
||||
// ToInternalApp converts the ApplicationSpec to the internal App structure
|
||||
func (s *ApplicationSpec) ToInternalApp() model.App {
|
||||
return model.App{
|
||||
Config: model.AppConfig{
|
||||
Domain: s.Config.Domain,
|
||||
},
|
||||
Users: model.AppUsers{
|
||||
Allow: s.Users.Allow,
|
||||
Block: s.Users.Block,
|
||||
},
|
||||
OAuth: model.AppOAuth{
|
||||
Whitelist: s.OAuth.Whitelist,
|
||||
Groups: s.OAuth.Groups,
|
||||
},
|
||||
IP: model.AppIP{
|
||||
Allow: s.IP.Allow,
|
||||
Block: s.IP.Block,
|
||||
Bypass: s.IP.Bypass,
|
||||
},
|
||||
Response: model.AppResponse{
|
||||
Headers: s.Response.Headers,
|
||||
BasicAuth: model.AppBasicAuth{
|
||||
Username: s.Response.BasicAuth.Username,
|
||||
Password: s.Response.BasicAuth.Password,
|
||||
PasswordFile: s.Response.BasicAuth.PasswordFile,
|
||||
},
|
||||
},
|
||||
Path: model.AppPath{
|
||||
Allow: s.Path.Allow,
|
||||
Block: s.Path.Block,
|
||||
},
|
||||
LDAP: model.AppLDAP{
|
||||
Groups: s.LDAP.Groups,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -175,38 +175,6 @@ func (in *Application) DeepCopyObject() runtime.Object {
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationSet) DeepCopyInto(out *ApplicationSet) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Application, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationSet.
|
||||
func (in *ApplicationSet) DeepCopy() *ApplicationSet {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplicationSet)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ApplicationSet) 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 *ApplicationSpec) DeepCopyInto(out *ApplicationSpec) {
|
||||
*out = *in
|
||||
|
||||
Reference in New Issue
Block a user