mirror of
https://github.com/storytold/irsa-manager.git
synced 2026-10-09 00:09:43 +00:00
add IRSA api
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
Copyright 2024.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
|
||||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
||||
|
||||
// IRSASpec defines the desired state of IRSA
|
||||
type IRSASpec struct {
|
||||
// ServiceAccount represents the Kubernetes service account associated with the IRSA
|
||||
ServiceAccount IRSAServiceAccount `json:"serviceAccount,omitempty"`
|
||||
// IamRole represents the IAM role details associated with the IRSA
|
||||
IamRole IamRole `json:"iamRole,omitempty"`
|
||||
// IamPolicies represents the list of IAM policies to be attached to the IAM role
|
||||
IamPolicies []string `json:"iamPolicies,omitempty"`
|
||||
}
|
||||
|
||||
// IRSAServiceAccount represents the details of the Kubernetes service account
|
||||
type IRSAServiceAccount struct {
|
||||
// Name represents the name of the Kubernetes service account
|
||||
Name string `json:"name,omitempty"`
|
||||
// Namespaces represents the list of namespaces where the service account is used
|
||||
Namespaces []string `json:"namespaces,omitempty"`
|
||||
}
|
||||
|
||||
// IamRole represents the IAM role configuration
|
||||
type IamRole struct {
|
||||
// Create specifies whether to create the IAM role or not
|
||||
Create bool `json:"create,omitempty"`
|
||||
// Name represents the name of the IAM role
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// IRSAStatus defines the observed state of IRSA
|
||||
type IRSAStatus struct {
|
||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
}
|
||||
|
||||
//+kubebuilder:object:root=true
|
||||
//+kubebuilder:subresource:status
|
||||
|
||||
// IRSA is the Schema for the irsas API
|
||||
type IRSA struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec IRSASpec `json:"spec,omitempty"`
|
||||
Status IRSAStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
//+kubebuilder:object:root=true
|
||||
|
||||
// IRSAList contains a list of IRSA
|
||||
type IRSAList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []IRSA `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&IRSA{}, &IRSAList{})
|
||||
}
|
||||
@@ -57,6 +57,85 @@ func (in *Discovery) DeepCopy() *Discovery {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IRSA) DeepCopyInto(out *IRSA) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
out.Status = in.Status
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IRSA.
|
||||
func (in *IRSA) DeepCopy() *IRSA {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IRSA)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *IRSA) 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 *IRSAList) DeepCopyInto(out *IRSAList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]IRSA, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IRSAList.
|
||||
func (in *IRSAList) DeepCopy() *IRSAList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IRSAList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *IRSAList) 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 *IRSAServiceAccount) DeepCopyInto(out *IRSAServiceAccount) {
|
||||
*out = *in
|
||||
if in.Namespaces != nil {
|
||||
in, out := &in.Namespaces, &out.Namespaces
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IRSAServiceAccount.
|
||||
func (in *IRSAServiceAccount) DeepCopy() *IRSAServiceAccount {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IRSAServiceAccount)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IRSASetup) DeepCopyInto(out *IRSASetup) {
|
||||
*out = *in
|
||||
@@ -155,6 +234,58 @@ func (in *IRSASetupStatus) DeepCopy() *IRSASetupStatus {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IRSASpec) DeepCopyInto(out *IRSASpec) {
|
||||
*out = *in
|
||||
in.ServiceAccount.DeepCopyInto(&out.ServiceAccount)
|
||||
out.IamRole = in.IamRole
|
||||
if in.IamPolicies != nil {
|
||||
in, out := &in.IamPolicies, &out.IamPolicies
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IRSASpec.
|
||||
func (in *IRSASpec) DeepCopy() *IRSASpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IRSASpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IRSAStatus) DeepCopyInto(out *IRSAStatus) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IRSAStatus.
|
||||
func (in *IRSAStatus) DeepCopy() *IRSAStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IRSAStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IamRole) DeepCopyInto(out *IamRole) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IamRole.
|
||||
func (in *IamRole) DeepCopy() *IamRole {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IamRole)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *S3Discovery) DeepCopyInto(out *S3Discovery) {
|
||||
*out = *in
|
||||
|
||||
Reference in New Issue
Block a user