Skip to content

Commit 14a4958

Browse files
ts-minidranicu
authored andcommitted
feat: adding oidc features to cluster-api
1 parent 8738a4f commit 14a4958

21 files changed

+5567
-6313
lines changed

api/v1beta1/conversion.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,8 @@ func Convert_v1beta1_OCIManagedClusterStatus_To_v1beta2_OCIManagedClusterStatus(
142142
func Convert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec(in *v1beta2.OCIManagedClusterSpec, out *OCIManagedClusterSpec, s conversion.Scope) error {
143143
return autoConvert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec(in, out, s)
144144
}
145+
146+
// Convert_v1beta2_ClusterOptions_To_v1beta1_ClusterOptions converts v1beta2 ClusterOptions to v1beta1 ClusterOptions
147+
func Convert_v1beta2_ClusterOptions_To_v1beta1_ClusterOptions(in *v1beta2.ClusterOptions, out *ClusterOptions, s conversion.Scope) error {
148+
return autoConvert_v1beta2_ClusterOptions_To_v1beta1_ClusterOptions(in, out, s)
149+
}

api/v1beta1/ocimanagedcontrolplane_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func (src *OCIManagedControlPlane) ConvertTo(dstRaw conversion.Hub) error {
3636
dst.Spec.ClusterType = restored.Spec.ClusterType
3737
dst.Spec.Addons = restored.Spec.Addons
3838
dst.Status.AddonStatus = restored.Status.AddonStatus
39+
dst.Spec.ClusterOption.OpenIdConnectDiscovery.IsOpenIdConnectDiscoveryEnabled = restored.Spec.ClusterOption.OpenIdConnectDiscovery.IsOpenIdConnectDiscoveryEnabled
3940
return nil
4041
}
4142

api/v1beta1/zz_generated.conversion.go

Lines changed: 7 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta2/ocimanagedcontrolplane_types.go

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package v1beta2
1818

1919
import (
20+
"github.com/oracle/oci-go-sdk/v65/containerengine"
2021
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
2223
)
@@ -122,8 +123,66 @@ type ClusterOptions struct {
122123
// AdmissionControllerOptions defines the properties that define supported admission controllers.
123124
// +optional
124125
AdmissionControllerOptions *AdmissionControllerOptions `json:"admissionControllerOptions,omitempty"`
126+
127+
// OpenIDConnectDiscovery specifies OIDC discovery settings
128+
// +optional
129+
OpenIdConnectDiscovery *OpenIDConnectDiscovery `json:"openIdConnectDiscovery,omitempty"`
130+
131+
//OpenIDConnectTokenAuthenticationConfig
132+
// +optional
133+
OpenIdConnectTokenAuthenticationConfig *OpenIDConnectTokenAuthenticationConfig `json:"openIdConnectTokenAuthenticationConfig,omitempty"`
134+
}
135+
136+
type OpenIDConnectDiscovery struct {
137+
// IsOpenIDConnectDiscoveryEnabled defines whether or not to enable the OIDC discovery.
138+
// +optional
139+
IsOpenIdConnectDiscoveryEnabled *bool `json:"isOpenIdConnectDiscoveryEnabled,omitempty"`
140+
}
141+
142+
type OpenIDConnectTokenAuthenticationConfig struct {
143+
// A Base64 encoded public RSA or ECDSA certificates used to sign your identity provider's web certificate.
144+
// +optional
145+
CaCertificate *string `json:"caCertificate,omitempty"`
146+
147+
// A client id that all tokens must be issued for.
148+
// +optional
149+
ClientId *string `json:"clientId,omitempty"`
150+
151+
// JWT claim to use as the user's group. If the claim is present it must be an array of strings.
152+
// +optional
153+
GroupsClaim *string `json:"groupsClaim,omitempty"`
154+
155+
// Prefix prepended to group claims to prevent clashes with existing names (such as system:groups).
156+
// +optional
157+
GroupsPrefix *string `json:"groupsPrefix,omitempty"`
158+
159+
// IsOpenIdConnectAuthEnabled defines whether or not to enable the OIDC authentication.
160+
IsOpenIdConnectAuthEnabled bool `json:"isOpenIdConnectAuthEnabled"`
161+
162+
// URL of the provider that allows the API server to discover public signing keys. Only URLs that use the https:// scheme are accepted. This is typically the provider's discovery URL, changed to have an empty path.
163+
// +optional
164+
IssuerUrl *string `json:"issuerUrl,omitempty"`
165+
166+
// A key=value pair that describes a required claim in the ID Token. If set, the claim is verified to be present in the ID Token with a matching value. Repeat this flag to specify multiple claims.
167+
// +optional
168+
RequiredClaims []KeyValue `json:"requiredClaims,omitempty"`
169+
170+
// The signing algorithms accepted. Default is ["RS256"].
171+
// +optional
172+
SigningAlgorithms []string `json:"signingAlgorithms,omitempty"`
173+
174+
// JWT claim to use as the user name. By default sub, which is expected to be a unique identifier of the end user. Admins can choose other claims, such as email or name, depending on their provider. However, claims other than email will be prefixed with the issuer URL to prevent naming clashes with other plugins.
175+
// +optional
176+
UsernameClaim *string `json:"usernameClaim,omitempty"`
177+
178+
// Prefix prepended to username claims to prevent clashes with existing names (such as system:users). For example, the value oidc: will create usernames like oidc:jane.doe. If this flag isn't provided and --oidc-username-claim is a value other than email the prefix defaults to ( Issuer URL )# where ( Issuer URL ) is the value of --oidc-issuer-url. The value - can be used to disable all prefixing.
179+
// +optional
180+
UsernamePrefix *string `json:"usernamePrefix,omitempty"`
125181
}
126182

183+
// KeyValue defines the properties that define a key value pair. This is alias to containerengine.KeyValue, to support the sdk type
184+
type KeyValue containerengine.KeyValue
185+
127186
// AddOnOptions defines the properties that define options for supported add-ons.
128187
type AddOnOptions struct {
129188
// IsKubernetesDashboardEnabled defines whether or not to enable the Kubernetes Dashboard add-on.

api/v1beta2/zz_generated.deepcopy.go

Lines changed: 117 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)