Skip to content
Open
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
36 changes: 36 additions & 0 deletions config/crd/bases/psmdb.percona.com_perconaservermongodbs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3954,6 +3954,18 @@ spec:
type: boolean
exposeType:
type: string
externalDNS:
properties:
domain:
type: string
prefix:
type: string
ttl:
minimum: 0
type: integer
required:
- domain
type: object
externalTrafficPolicy:
type: string
internalTrafficPolicy:
Expand Down Expand Up @@ -14783,6 +14795,18 @@ spec:
type: boolean
exposeType:
type: string
externalDNS:
properties:
domain:
type: string
prefix:
type: string
ttl:
minimum: 0
type: integer
required:
- domain
type: object
externalTrafficPolicy:
type: string
internalTrafficPolicy:
Expand Down Expand Up @@ -23229,6 +23253,18 @@ spec:
type: object
exposeType:
type: string
externalDNS:
properties:
domain:
type: string
prefix:
type: string
ttl:
minimum: 0
type: integer
required:
- domain
type: object
externalTrafficPolicy:
type: string
internalTrafficPolicy:
Expand Down
36 changes: 36 additions & 0 deletions deploy/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4841,6 +4841,18 @@ spec:
type: boolean
exposeType:
type: string
externalDNS:
properties:
domain:
type: string
prefix:
type: string
ttl:
minimum: 0
type: integer
required:
- domain
type: object
externalTrafficPolicy:
type: string
internalTrafficPolicy:
Expand Down Expand Up @@ -15670,6 +15682,18 @@ spec:
type: boolean
exposeType:
type: string
externalDNS:
properties:
domain:
type: string
prefix:
type: string
ttl:
minimum: 0
type: integer
required:
- domain
type: object
externalTrafficPolicy:
type: string
internalTrafficPolicy:
Expand Down Expand Up @@ -24116,6 +24140,18 @@ spec:
type: object
exposeType:
type: string
externalDNS:
properties:
domain:
type: string
prefix:
type: string
ttl:
minimum: 0
type: integer
required:
- domain
type: object
externalTrafficPolicy:
type: string
internalTrafficPolicy:
Expand Down
12 changes: 12 additions & 0 deletions deploy/cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ spec:
# rack: rack-22
# internalTrafficPolicy: Local
# externalTrafficPolicy: Local
# externalDNS:
# prefix: "service-name"
# domain: "mongo.example.com"
# ttl: 300
resources:
limits:
cpu: "600m"
Expand Down Expand Up @@ -573,6 +577,10 @@ spec:
# rack: rack-22
# internalTrafficPolicy: Local
# externalTrafficPolicy: Local
# externalDNS:
# prefix: "service-name"
# domain: "mongo.example.com"
# ttl: 300
resources:
limits:
cpu: "600m"
Expand Down Expand Up @@ -698,6 +706,10 @@ spec:
# nodePort: 32017
# internalTrafficPolicy: Local
# externalTrafficPolicy: Local
# externalDNS:
# prefix: "service-name"
# domain: "mongo.example.com"
# ttl: 300
# hostAliases:
# - ip: "10.10.0.2"
# hostnames:
Expand Down
36 changes: 36 additions & 0 deletions deploy/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4841,6 +4841,18 @@ spec:
type: boolean
exposeType:
type: string
externalDNS:
properties:
domain:
type: string
prefix:
type: string
ttl:
minimum: 0
type: integer
required:
- domain
type: object
externalTrafficPolicy:
type: string
internalTrafficPolicy:
Expand Down Expand Up @@ -15670,6 +15682,18 @@ spec:
type: boolean
exposeType:
type: string
externalDNS:
properties:
domain:
type: string
prefix:
type: string
ttl:
minimum: 0
type: integer
required:
- domain
type: object
externalTrafficPolicy:
type: string
internalTrafficPolicy:
Expand Down Expand Up @@ -24116,6 +24140,18 @@ spec:
type: object
exposeType:
type: string
externalDNS:
properties:
domain:
type: string
prefix:
type: string
ttl:
minimum: 0
type: integer
required:
- domain
type: object
externalTrafficPolicy:
type: string
internalTrafficPolicy:
Expand Down
36 changes: 36 additions & 0 deletions deploy/cw-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4841,6 +4841,18 @@ spec:
type: boolean
exposeType:
type: string
externalDNS:
properties:
domain:
type: string
prefix:
type: string
ttl:
minimum: 0
type: integer
required:
- domain
type: object
externalTrafficPolicy:
type: string
internalTrafficPolicy:
Expand Down Expand Up @@ -15670,6 +15682,18 @@ spec:
type: boolean
exposeType:
type: string
externalDNS:
properties:
domain:
type: string
prefix:
type: string
ttl:
minimum: 0
type: integer
required:
- domain
type: object
externalTrafficPolicy:
type: string
internalTrafficPolicy:
Expand Down Expand Up @@ -24116,6 +24140,18 @@ spec:
type: object
exposeType:
type: string
externalDNS:
properties:
domain:
type: string
prefix:
type: string
ttl:
minimum: 0
type: integer
required:
- domain
type: object
externalTrafficPolicy:
type: string
internalTrafficPolicy:
Expand Down
36 changes: 36 additions & 0 deletions e2e-tests/version-service/conf/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4841,6 +4841,18 @@ spec:
type: boolean
exposeType:
type: string
externalDNS:
properties:
domain:
type: string
prefix:
type: string
ttl:
minimum: 0
type: integer
required:
- domain
type: object
externalTrafficPolicy:
type: string
internalTrafficPolicy:
Expand Down Expand Up @@ -15670,6 +15682,18 @@ spec:
type: boolean
exposeType:
type: string
externalDNS:
properties:
domain:
type: string
prefix:
type: string
ttl:
minimum: 0
type: integer
required:
- domain
type: object
externalTrafficPolicy:
type: string
internalTrafficPolicy:
Expand Down Expand Up @@ -24116,6 +24140,18 @@ spec:
type: object
exposeType:
type: string
externalDNS:
properties:
domain:
type: string
prefix:
type: string
ttl:
minimum: 0
type: integer
required:
- domain
type: object
externalTrafficPolicy:
type: string
internalTrafficPolicy:
Expand Down
18 changes: 18 additions & 0 deletions pkg/apis/psmdb/v1/psmdb_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,15 @@ func (cr *PerconaServerMongoDB) CheckNSetDefaults(ctx context.Context, platform
if len(cr.Spec.Sharding.Mongos.ServiceAccountName) == 0 && cr.CompareVersion("1.16.0") >= 0 {
cr.Spec.Sharding.Mongos.ServiceAccountName = WorkloadSA
}

if dns := cr.Spec.Sharding.Mongos.Expose.ExternalDNS; dns != nil {
if dns.Domain == "" {
return errors.New("externalDNS requires domain for mongos")
}
if dns.Prefix == "" {
dns.Prefix = cr.Name
}
}
}

if mongos := cr.Spec.Sharding.Mongos; mongos != nil && cr.CompareVersion("1.18.0") >= 0 && cr.Status.State == AppStateInit {
Expand Down Expand Up @@ -720,6 +729,15 @@ func (rs *ReplsetSpec) SetDefaults(platform version.Platform, cr *PerconaServerM
}
}

if dns := rs.Expose.ExternalDNS; dns != nil {
if dns.Domain == "" {
return fmt.Errorf("externalDNS requires domain for replset %s", rs.Name)
}
if dns.Prefix == "" {
dns.Prefix = cr.Name
}
}

if cr.CompareVersion("1.18.0") >= 0 && cr.Status.State == AppStateInit {
if rs.Expose.DeprecatedExposeType != "" {
log.Info("Field `.expose.exposeType` was deprecated in 1.18.0. Consider using `.expose.type` instead", "cluster", cr.Name, "namespace", cr.Namespace, "replset", rs.Name)
Expand Down
10 changes: 10 additions & 0 deletions pkg/apis/psmdb/v1/psmdb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,16 @@ type Expose struct {

InternalTrafficPolicy *corev1.ServiceInternalTrafficPolicy `json:"internalTrafficPolicy,omitempty"`
ExternalTrafficPolicy corev1.ServiceExternalTrafficPolicy `json:"externalTrafficPolicy,omitempty"`

ExternalDNS *ExternalDNSConfig `json:"externalDNS,omitempty"`
}

type ExternalDNSConfig struct {
Prefix string `json:"prefix,omitempty"`
// +kubebuilder:validation:Required
Domain string `json:"domain"`
// +kubebuilder:validation:Minimum=0
TTL int `json:"ttl,omitempty"`
}

func (e *Expose) SaveOldMeta() bool {
Expand Down
Loading
Loading