Skip to content

Commit 977ecec

Browse files
committed
Add EndpointAccess field
- remove cluster expirationTime
1 parent be41c4f commit 977ecec

File tree

4 files changed

+46
-5
lines changed

4 files changed

+46
-5
lines changed

config/crd/bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ spec:
108108
type: string
109109
type: object
110110
x-kubernetes-map-type: atomic
111+
endpointAccess:
112+
default: Public
113+
description: EndpointAccess specifies the publishing scope of cluster
114+
endpoints. The default is Public.
115+
enum:
116+
- Public
117+
- Private
118+
type: string
111119
etcdEncryptionKMSArn:
112120
description: EtcdEncryptionKMSArn is the ARN of the KMS key used to
113121
encrypt etcd. The key itself needs to be created out-of-band by
@@ -372,7 +380,7 @@ spec:
372380
description: RosaControlPlaneStatus defines the observed state of ROSAControlPlane.
373381
properties:
374382
conditions:
375-
description: Conditions specifies the cpnditions for the managed control
383+
description: Conditions specifies the conditions for the managed control
376384
plane
377385
items:
378386
description: Condition defines an observation of a Cluster API resource
@@ -444,7 +452,7 @@ spec:
444452
type: boolean
445453
oidcEndpointURL:
446454
description: OIDCEndpointURL is the endpoint url for the managed OIDC
447-
porvider.
455+
provider.
448456
type: string
449457
ready:
450458
default: false

controlplane/rosa/api/v1beta2/rosacontrolplane_types.go

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ import (
2525
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
2626
)
2727

28+
// RosaEndpointAccessType specifies the publishing scope of cluster endpoints.
29+
type RosaEndpointAccessType string
30+
31+
const (
32+
// Public endpoint access allows public API server access and
33+
// private node communication with the control plane.
34+
Public RosaEndpointAccessType = "Public"
35+
36+
// Private endpoint access allows only private API server access and private
37+
// node communication with the control plane.
38+
Private RosaEndpointAccessType = "Private"
39+
)
40+
2841
// RosaControlPlaneSpec defines the desired state of ROSAControlPlane.
2942
type RosaControlPlaneSpec struct { //nolint: maligned
3043
// Cluster name must be valid DNS-1035 label, so it must consist of lower case alphanumeric
@@ -90,6 +103,14 @@ type RosaControlPlaneSpec struct { //nolint: maligned
90103
// +optional
91104
Network *NetworkSpec `json:"network,omitempty"`
92105

106+
// EndpointAccess specifies the publishing scope of cluster endpoints. The
107+
// default is Public.
108+
//
109+
// +kubebuilder:validation:Enum=Public;Private
110+
// +kubebuilder:default=Public
111+
// +optional
112+
EndpointAccess RosaEndpointAccessType `json:"endpointAccess,omitempty"`
113+
93114
// The instance type to use, for example `r5.xlarge`. Instance type ref; https://aws.amazon.com/ec2/instance-types/
94115
// +optional
95116
InstanceType string `json:"instanceType,omitempty"`
@@ -543,14 +564,14 @@ type RosaControlPlaneStatus struct {
543564
//
544565
// +optional
545566
FailureMessage *string `json:"failureMessage,omitempty"`
546-
// Conditions specifies the cpnditions for the managed control plane
567+
// Conditions specifies the conditions for the managed control plane
547568
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
548569

549570
// ID is the cluster ID given by ROSA.
550571
ID string `json:"id,omitempty"`
551572
// ConsoleURL is the url for the openshift console.
552573
ConsoleURL string `json:"consoleURL,omitempty"`
553-
// OIDCEndpointURL is the endpoint url for the managed OIDC porvider.
574+
// OIDCEndpointURL is the endpoint url for the managed OIDC provider.
554575
OIDCEndpointURL string `json:"oidcEndpointURL,omitempty"`
555576
}
556577

controlplane/rosa/api/v1beta2/zz_generated.defaults.go

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

controlplane/rosa/controllers/rosacontrolplane_controller.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ func (r *ROSAControlPlaneReconciler) reconcileNormal(ctx context.Context, rosaSc
280280
MultiAZ: true,
281281
Version: ocm.CreateVersionID(rosaScope.ControlPlane.Spec.Version, ocm.DefaultChannelGroup),
282282
ChannelGroup: ocm.DefaultChannelGroup,
283-
Expiration: time.Now().Add(1 * time.Hour),
284283
DisableWorkloadMonitoring: ptr.To(true),
285284
DefaultIngress: ocm.NewDefaultIngressSpec(), // n.b. this is a no-op when it's set to the default value
286285
ComputeMachineType: rosaScope.ControlPlane.Spec.InstanceType,
@@ -304,6 +303,11 @@ func (r *ROSAControlPlaneReconciler) reconcileNormal(ctx context.Context, rosaSc
304303
AWSCreator: creator,
305304
}
306305

306+
if rosaScope.ControlPlane.Spec.EndpointAccess == rosacontrolplanev1.Private {
307+
ocmClusterSpec.Private = ptr.To(true)
308+
ocmClusterSpec.PrivateLink = ptr.To(true)
309+
}
310+
307311
if networkSpec := rosaScope.ControlPlane.Spec.Network; networkSpec != nil {
308312
if networkSpec.MachineCIDR != "" {
309313
_, machineCIDR, err := net.ParseCIDR(networkSpec.MachineCIDR)

0 commit comments

Comments
 (0)