mirror of
https://github.com/storytold/irsa-manager.git
synced 2026-10-09 00:09:43 +00:00
serviceaccount
This commit is contained in:
@@ -49,8 +49,7 @@ type IRSAReconciler struct {
|
||||
func (r *IRSAReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
|
||||
_ = log.FromContext(ctx)
|
||||
|
||||
// TODO(user): your logic here
|
||||
|
||||
// roleArn: arn:aws:iam::{accountId}:role/{roleName}
|
||||
return ctrl.Result{}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
package manifests
|
||||
@@ -0,0 +1,34 @@
|
||||
package manifests
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
)
|
||||
|
||||
type ServiceAccountBuilder struct {
|
||||
annotation map[string]string
|
||||
}
|
||||
|
||||
func NewServiceAccountBuilder() *ServiceAccountBuilder {
|
||||
return &ServiceAccountBuilder{}
|
||||
}
|
||||
|
||||
func (b *ServiceAccountBuilder) WithAnnotation(annotation map[string]string) *ServiceAccountBuilder {
|
||||
b.annotation = annotation
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *ServiceAccountBuilder) Build(namespacedName types.NamespacedName) *corev1.ServiceAccount {
|
||||
return &corev1.ServiceAccount{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
APIVersion: corev1.SchemeGroupVersion.String(),
|
||||
Kind: "ServiceAccount",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: namespacedName.Name,
|
||||
Namespace: namespacedName.Namespace,
|
||||
Annotations: b.annotation,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package webhook
|
||||
|
||||
import (
|
||||
"github.com/kkb0318/irsa-manager/internal/manifests"
|
||||
regv1 "k8s.io/api/admissionregistration/v1"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
@@ -136,16 +137,7 @@ func (b *baseManifestFactory) deployment() *appsv1.Deployment {
|
||||
}
|
||||
|
||||
func (b *baseManifestFactory) serviceAccount() *corev1.ServiceAccount {
|
||||
return &corev1.ServiceAccount{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
APIVersion: corev1.SchemeGroupVersion.String(),
|
||||
Kind: "ServiceAccount",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: b.serviceAccountMeta.Name,
|
||||
Namespace: b.serviceAccountMeta.Namespace,
|
||||
},
|
||||
}
|
||||
return manifests.NewServiceAccountBuilder().Build(b.serviceAccountMeta)
|
||||
}
|
||||
|
||||
func (b *baseManifestFactory) clusterRole() *rbacv1.ClusterRole {
|
||||
|
||||
Reference in New Issue
Block a user