Skip to content

Add source of DNS configuration to AWSPlatformStatus #1397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: ""
description: dnsConfig contains information about the type of DNS solution in use for the cluster.
properties:
provider:
default: ""
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 "UserAndClusterProvided". When the cluster's DNS solution is the default for IPI or UPI, then `provider` is set to "" which is also its default value.
enum:
- UserAndClusterProvided
- ""
type: string
x-kubernetes-validations:
- message: provider 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,
}
)
129 changes: 129 additions & 0 deletions config/v1/techpreview.infrastructure.testsuite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,132 @@ tests:
type: FooBar
type: BareMetal
expectedStatusError: "status.platformStatus.baremetal.loadBalancer.type: Unsupported value: \"FooBar\": supported values: \"OpenShiftManagedDefault\", \"UserManaged\""
- name: Should set dnsConfig provider to "" 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:
provider: ""
type: AWS
- name: Should be able to override the default Provider with a valid value
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:
dnsConfig:
provider: UserAndClusterProvided
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:
provider: UserAndClusterProvided
type: AWS
- name: Should be not be able to modify immutable 'provider'
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
aws: {}
type: AWS
status:
platform: AWS
platformStatus:
aws:
dnsConfig:
provider: UserAndClusterProvided
type: AWS
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
aws: {}
type: AWS
status:
platform: AWS
platformStatus:
aws:
dnsConfig:
provider: ""
type: AWS
expectedStatusError: "status.platformStatus.aws.dnsConfig.provider: Invalid value: \"string\": provider is immutable once set"
- name: Should be not be able to set Provider with an invalid value
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:
dnsConfig:
provider: CloudProvided
type: AWS
expectedStatusError: "status.platformStatus.aws.dnsConfig.provider: Unsupported value: \"CloudProvided\": supported values: \"UserAndClusterProvided\", \"\""
1 change: 1 addition & 0 deletions config/v1/types_feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ var FeatureSets = map[FeatureSet]*FeatureGateEnabledDisabled{
with(automatedEtcdBackup).
without(machineAPIOperatorDisableMachineHealthCheckController).
with(adminNetworkPolicy).
with(customDNSAWS).
toFeatures(defaultFeatures),
LatencySensitive: newDefaultFeatures().
toFeatures(defaultFeatures),
Expand Down
40 changes: 40 additions & 0 deletions config/v1/types_infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,14 @@ 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.
// +default={"provider": ""}
// +kubebuilder:default={"provider": ""}
// +openshift:enable:FeatureSets=TechPreviewNoUpgrade
// +optional
DNSConfig *DNSConfigurationType `json:"dnsConfig,omitempty"`
}

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

// DNSConfigurationType contains information about who configures DNS for the
// cluster.
// +union
type DNSConfigurationType struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To enable external DNS, I think we are only concerned about using coreDNS to run ingress. Should that be taken into account for the shape of this API? Any concerns there?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment was unclear. My concern is that this shape may give the impression that this is the DNS config for everything (API & Ingress) but I believe our current direction is that this will only treat ingress.

Copy link
Contributor Author

@sadasu sadasu Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment suggests you are looking at this config as "who provides DNS for Ingress?" Whereas, this API is currently designed to indicate "who provides DNS for the cluster?". I think the 2nd question is the most generic form of the question.

We need DNS for Ingress to be functional during cluster bringup so we have a CoreDNS pod that provides that during cluster bring up. When the cluster is up, we do want the user to update their DNS solution for the *.apps entry too. When all steps are completed, the customer's DNS solution resolves API, API-Int and Ingress.

The enhancement proposal openshift/enhancements#1400 talks about this in greater detail.

// 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 "UserAndClusterProvided".
// When the cluster's DNS solution is the default for IPI or UPI, then
// `provider` is set to "" which is also its default value.
// +default=""
// +kubebuilder:default:=""
// +kubebuilder:validation:Enum="UserAndClusterProvided";""
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="oldSelf == '' || self == oldSelf",message="provider is immutable once set"
// +unionDiscriminator
// +optional
Provider DNSProviderType `json:"provider,omitempty"`
}

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

const (
// DNSUserAndClusterProvided indicates that the user configures DNS for API and API-Int.
// The cluster handles some of its in-cluster DNS needs without user intervention.
DNSUserAndClusterProvided DNSProviderType = "UserAndClusterProvided"

// DNSDefault indicates the cluster's default way of handling DNS configuration.
// This refers to the default DNS configuration expected for both IPI and UPI installs.
DNSDefault DNSProviderType = ""
)

// 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.

41 changes: 40 additions & 1 deletion openapi/generated_openapi/zz_generated.openapi.go

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

24 changes: 24 additions & 0 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4170,6 +4170,13 @@
"region"
],
"properties": {
"dnsConfig": {
"description": "dnsConfig contains information about the type of DNS solution in use for the cluster.",
"default": {
"provider": ""
},
"$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 +5719,23 @@
}
}
},
"com.github.openshift.api.config.v1.DNSConfigurationType": {
"description": "DNSConfigurationType contains information about who configures DNS for the cluster.",
"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 \"UserAndClusterProvided\". When the cluster's DNS solution is the default for IPI or UPI, then `provider` is set to \"\" which is also its default value.",
"type": "string",
"default": ""
}
},
"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
Loading