From 5ffb448ecd463df1aaa5a71fb3f221a22f4a1d3f Mon Sep 17 00:00:00 2001 From: kkb0318 Date: Fri, 26 Jul 2024 20:12:02 +0900 Subject: [PATCH] update api for eks support --- api/v1alpha1/irsasetup_types.go | 21 ++++++++++++++++--- charts/irsa-manager/crds/irsasetup-crd.yaml | 14 +++++++++++-- ...-manager.kkb0318.github.io_irsasetups.yaml | 14 +++++++++++-- docs/api.md | 19 +++++++++++++++-- 4 files changed, 59 insertions(+), 9 deletions(-) diff --git a/api/v1alpha1/irsasetup_types.go b/api/v1alpha1/irsasetup_types.go index 2f4910a..285810e 100644 --- a/api/v1alpha1/irsasetup_types.go +++ b/api/v1alpha1/irsasetup_types.go @@ -33,17 +33,32 @@ type IRSASetupSpec struct { // +required Cleanup bool `json:"cleanup"` - // Mode (Optional, Future Feature) Defines how the controller will operate once this feature is enabled. - // Currently unused. Planned values: + // Mode specifies the operation mode of the controller. + // Possible values: // - "selfhosted": For self-managed Kubernetes clusters. // - "eks": For Amazon EKS environments. - Mode string `json:"mode,omitempty"` + // Default: "selfhosted" + Mode SetupMode `json:"mode,omitempty"` // Discovery configures the IdP Discovery process, essential for setting up IRSA by locating // the OIDC provider information. + // Only applicable when Mode is "selfhosted". Discovery Discovery `json:"discovery"` + + // IamOIDCProvider configures IAM OIDC IamOIDCProvider Name + // Only applicable when Mode is "eks". + IamOIDCProvider string `json:"provider,omitempty"` } +// +kubebuilder:default=selfhosted +// +kubebuilder:validation:Enum=selfhosted;eks +type SetupMode string + +const ( + ModeSelfhosted = SetupMode("selfhosted") + ModeEks = SetupMode("eks") +) + // Discovery holds the configuration for IdP Discovery, which is crucial for locating // the OIDC provider in a self-hosted environment. type Discovery struct { diff --git a/charts/irsa-manager/crds/irsasetup-crd.yaml b/charts/irsa-manager/crds/irsasetup-crd.yaml index 7cc00d0..b6bcd31 100644 --- a/charts/irsa-manager/crds/irsasetup-crd.yaml +++ b/charts/irsa-manager/crds/irsasetup-crd.yaml @@ -52,6 +52,7 @@ spec: description: |- Discovery configures the IdP Discovery process, essential for setting up IRSA by locating the OIDC provider information. + Only applicable when Mode is "selfhosted". properties: s3: description: S3 specifies the AWS S3 bucket details where the @@ -72,10 +73,19 @@ spec: type: object mode: description: |- - Mode (Optional, Future Feature) Defines how the controller will operate once this feature is enabled. - Currently unused. Planned values: + Mode specifies the operation mode of the controller. + Possible values: - "selfhosted": For self-managed Kubernetes clusters. - "eks": For Amazon EKS environments. + Default: "selfhosted" + enum: + - selfhosted + - eks + type: string + provider: + description: |- + IamOIDCProvider configures IAM OIDC IamOIDCProvider Name + Only applicable when Mode is "eks". type: string required: - cleanup diff --git a/config/crd/bases/irsa-manager.kkb0318.github.io_irsasetups.yaml b/config/crd/bases/irsa-manager.kkb0318.github.io_irsasetups.yaml index c8fe6c9..0cc7e3f 100644 --- a/config/crd/bases/irsa-manager.kkb0318.github.io_irsasetups.yaml +++ b/config/crd/bases/irsa-manager.kkb0318.github.io_irsasetups.yaml @@ -53,6 +53,7 @@ spec: description: |- Discovery configures the IdP Discovery process, essential for setting up IRSA by locating the OIDC provider information. + Only applicable when Mode is "selfhosted". properties: s3: description: S3 specifies the AWS S3 bucket details where the @@ -73,10 +74,19 @@ spec: type: object mode: description: |- - Mode (Optional, Future Feature) Defines how the controller will operate once this feature is enabled. - Currently unused. Planned values: + Mode specifies the operation mode of the controller. + Possible values: - "selfhosted": For self-managed Kubernetes clusters. - "eks": For Amazon EKS environments. + Default: "selfhosted" + enum: + - selfhosted + - eks + type: string + provider: + description: |- + IamOIDCProvider configures IAM OIDC IamOIDCProvider Name + Only applicable when Mode is "eks". type: string required: - cleanup diff --git a/docs/api.md b/docs/api.md index 3d29967..3bb9855 100644 --- a/docs/api.md +++ b/docs/api.md @@ -102,8 +102,9 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | | `cleanup` _boolean_ | Cleanup, when enabled, allows the IRSASetup to perform garbage collection
of resources that are no longer needed or managed. | | | -| `mode` _string_ | Mode (Optional, Future Feature) Defines how the controller will operate once this feature is enabled.
Currently unused. Planned values:
- "selfhosted": For self-managed Kubernetes clusters.
- "eks": For Amazon EKS environments. | | | -| `discovery` _[Discovery](#discovery)_ | Discovery configures the IdP Discovery process, essential for setting up IRSA by locating
the OIDC provider information. | | | +| `mode` _[SetupMode](#setupmode)_ | Mode specifies the operation mode of the controller.
Possible values:
- "selfhosted": For self-managed Kubernetes clusters.
- "eks": For Amazon EKS environments.
Default: "selfhosted" | | Enum: [selfhosted eks]
| +| `discovery` _[Discovery](#discovery)_ | Discovery configures the IdP Discovery process, essential for setting up IRSA by locating
the OIDC provider information.
Only applicable when Mode is "selfhosted". | | | +| `provider` _string_ | IamOIDCProvider configures IAM OIDC IamOIDCProvider Name
Only applicable when Mode is "eks". | | | @@ -164,3 +165,17 @@ _Appears in:_ +#### SetupMode + +_Underlying type:_ _string_ + + + +_Validation:_ +- Enum: [selfhosted eks] + +_Appears in:_ +- [IRSASetupSpec](#irsasetupspec) + + +