Skip to content

Commit

Permalink
Add custom DNS configuration to AWSPlatformStatus
Browse files Browse the repository at this point in the history
When customer provides their own DNS solution, they are expected
to pre-create the API and API-Int LBs. This information is added
to AWSPlatformStatus.
  • Loading branch information
sadasu committed Jul 18, 2023
1 parent de6ad79 commit 5402364
Show file tree
Hide file tree
Showing 9 changed files with 202 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,24 @@ spec:
aws:
description: AWS contains settings specific to the Amazon Web Services infrastructure provider.
properties:
dnsConfig:
default:
provider: ClusterProvided
description: dnsConfig contains information about the type of DNS solution in use for the cluster and its related configuration.
properties:
provider:
default: ClusterProvided
description: provider determines which DNS solution is in use for this cluster. When the user wants to use their own DNS solution, the `provider` is set to "UserProvided". In this state, the user is expected to pre-create the Load Balancers for API and API-Int. The names of these pre-created Load Balancers are saved. When the cluster is resposible for its own DNS configuration, this field is set to "ClusterProvided". The Load Balancers are also created by the cluster. The default is "ClusterProvided".
enum:
- UserProvided
- ClusterProvided
type: string
x-kubernetes-validations:
- message: type is immutable once set
rule: oldSelf == '' || self == oldSelf
required:
- provider
type: object
region:
description: region holds the default AWS region for new AWS resources created by the cluster.
type: string
Expand Down
10 changes: 10 additions & 0 deletions config/v1/feature_gates.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,14 @@ var (
ResponsiblePerson: "msluiter",
OwningProduct: ocpSpecific,
}

FeatureGateCustomDNSAWS = FeatureGateName("CustomDNSAWS")
customDNSAWS = FeatureGateDescription{
FeatureGateAttributes: FeatureGateAttributes{
Name: FeatureGateCustomDNSAWS,
},
OwningJiraComponent: "installer",
ResponsiblePerson: "sadasu",
OwningProduct: ocpSpecific,
}
)
36 changes: 36 additions & 0 deletions config/v1/techpreview.infrastructure.testsuite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -662,3 +662,39 @@ tests:
type: External
external:
cloudControllerManager: {}
- name: Should set dnsConfig provider to ClusterProvided if not specified
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
aws: {}
type: AWS
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
aws: {}
type: AWS
status:
platform: AWS
platformStatus:
aws: {}
type: AWS
expected: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
aws: {}
type: AWS
status:
controlPlaneTopology: HighlyAvailable
cpuPartitioning: None
infrastructureTopology: HighlyAvailable
platform: AWS
platformStatus:
aws:
dnsConfig: {}
type: AWS
1 change: 1 addition & 0 deletions config/v1/types_feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ var FeatureSets = map[FeatureSet]*FeatureGateEnabledDisabled{
with(automatedEtcdBackup).
without(machineAPIOperatorDisableMachineHealthCheckController).
with(adminNetworkPolicy).
with(customDNSAWS).
toFeatures(defaultFeatures),
LatencySensitive: newDefaultFeatures().
toFeatures(defaultFeatures),
Expand Down
39 changes: 39 additions & 0 deletions config/v1/types_infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,13 @@ type AWSPlatformStatus struct {
// +kubebuilder:validation:MaxItems=25
// +optional
ResourceTags []AWSResourceTag `json:"resourceTags,omitempty"`

// dnsConfig contains information about the type of DNS solution in use
// for the cluster and its related configuration.
// +default={"provider": "ClusterProvided"}
// +kubebuilder:default={"provider": "ClusterProvided"}
// +openshift:enable:FeatureSets=TechPreviewNoUpgrade
DNSConfig *DNSConfigurationType `json:"dnsConfig"`
}

// AWSResourceTag is a tag to apply to AWS resources created for the cluster.
Expand All @@ -500,6 +507,38 @@ type AWSResourceTag struct {
Value string `json:"value"`
}

// DNSConfigurationType contains information about API and API-Int Load Balancers
// and who is responsible for that configuration.
// +union
type DNSConfigurationType struct {
// provider determines which DNS solution is in use for this cluster.
// When the user wants to use their own DNS solution, the `provider` is set to
// "UserProvided". In this state, the user is expected to pre-create the Load
// Balancers for API and API-Int. The names of these pre-created Load Balancers
// are saved.
// When the cluster is resposible for its own DNS configuration, this field is
// set to "ClusterProvided". The Load Balancers are also created by the cluster.
// The default is "ClusterProvided".
// +default="ClusterProvided"
// +kubebuilder:default:="ClusterProvided"
// +kubebuilder:validation:Enum="UserProvided";"ClusterProvided"
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="oldSelf == '' || self == oldSelf",message="type is immutable once set"
// +unionDiscriminator
Provider DNSProviderType `json:"provider,omitempty"`
}

// DNSProviderType defines the source of the DNS and LB configuration.
type DNSProviderType string

const (
// DNSUserProvided indicates that the user provides the LB and DNS for API and API-Int.
DNSUserProvided DNSProviderType = "UserProvided"

// DNSClusterProvided indicates that the cluster provides the LB and DNS for API and API-Int.
DNSClusterProvided DNSProviderType = "ClusterProvided"
)

// AzurePlatformSpec holds the desired state of the Azure infrastructure provider.
// This only includes fields that can be modified in the cluster.
type AzurePlatformSpec struct{}
Expand Down
21 changes: 21 additions & 0 deletions config/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions config/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 41 additions & 2 deletions openapi/generated_openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 26 additions & 1 deletion openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4167,9 +4167,17 @@
"description": "AWSPlatformStatus holds the current status of the Amazon Web Services infrastructure provider.",
"type": "object",
"required": [
"region"
"region",
"dnsConfig"
],
"properties": {
"dnsConfig": {
"description": "dnsConfig contains information about the type of DNS solution in use for the cluster and its related configuration.",
"default": {
"provider": "ClusterProvided"
},
"$ref": "#/definitions/com.github.openshift.api.config.v1.DNSConfigurationType"
},
"region": {
"description": "region holds the default AWS region for new AWS resources created by the cluster.",
"type": "string",
Expand Down Expand Up @@ -5712,6 +5720,23 @@
}
}
},
"com.github.openshift.api.config.v1.DNSConfigurationType": {
"description": "DNSConfigurationType contains information about API and API-Int Load Balancers and who is responsible for that configuration.",
"type": "object",
"properties": {
"provider": {
"description": "provider determines which DNS solution is in use for this cluster. When the user wants to use their own DNS solution, the `provider` is set to \"UserProvided\". In this state, the user is expected to pre-create the Load Balancers for API and API-Int. The names of these pre-created Load Balancers are saved. When the cluster is resposible for its own DNS configuration, this field is set to \"ClusterProvided\". The Load Balancers are also created by the cluster. The default is \"ClusterProvided\".",
"type": "string",
"default": "ClusterProvided"
}
},
"x-kubernetes-unions": [
{
"discriminator": "provider",
"fields-to-discriminateBy": {}
}
]
},
"com.github.openshift.api.config.v1.DNSList": {
"description": "Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).",
"type": "object",
Expand Down

0 comments on commit 5402364

Please sign in to comment.