Skip to content
Merged
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
3 changes: 3 additions & 0 deletions api/v1alpha1/capoperator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="State",type=string,JSONPath=".status.state"
// +kubebuilder:metadata:labels="app.kubernetes.io/component=customresourcedefinition";"app.kubernetes.io/instance=capoperators.operator.sme.sap.com";"app.kubernetes.io/name=capoperators.operator.sme.sap.com"

// CAPOperator is the Schema for the CAPOperators API
type CAPOperator struct {
Expand All @@ -35,6 +36,7 @@ type CAPOperatorStatus struct {
component.Status `json:",inline"`
}

// +kubebuilder:validation:ExactlyOneOf=dnsTarget;ingressGatewayLabels
// CAPOperatorSpec defines the desired state of CAPOperator
type CAPOperatorSpec struct {
// SubscriptionServer specification
Expand Down Expand Up @@ -126,6 +128,7 @@ type GrafanaDashboard struct {
ConfigMapLabels map[string]string `json:"configMapLabels,omitempty"`
}

// +kubebuilder:validation:AtMostOneOf=gardener;certManager
type CertificateConfig struct {
// Gardener configuration
Gardener Gardener `json:"gardener,omitempty"`
Expand Down
44 changes: 17 additions & 27 deletions config/crd/operator.sme.sap.com_capoperators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.20.1
labels:
app.kubernetes.io/name: capoperators.operator.sme.sap.com
app.kubernetes.io/instance: capoperators.operator.sme.sap.com
app.kubernetes.io/component: customresourcedefinition
app.kubernetes.io/instance: capoperators.operator.sme.sap.com
app.kubernetes.io/name: capoperators.operator.sme.sap.com
name: capoperators.operator.sme.sap.com
spec:
group: operator.sme.sap.com
Expand Down Expand Up @@ -46,11 +46,6 @@ spec:
type: object
spec:
description: CAPOperatorSpec defines the desired state of CAPOperator
oneOf:
- required:
- ingressGatewayLabels
- required:
- dnsTarget
properties:
controller:
description: Controller specification
Expand Down Expand Up @@ -2137,16 +2132,6 @@ spec:
properties:
certificateConfig:
description: Certificate configuration
anyOf:
- oneOf:
- required:
- certManager
- required:
- gardener
- not:
required:
- certManager
- gardener
properties:
certManager:
description: CertManager configuration
Expand All @@ -2172,6 +2157,11 @@ spec:
type: string
type: object
type: object
x-kubernetes-validations:
- message: at most one of the fields in [gardener certManager]
may be set
rule: '[has(self.gardener),has(self.certManager)].filter(x,x==true).size()
<= 1'
certificateManager:
description: Certificate manager which can be either `Gardener`
or `CertManager`
Expand All @@ -2189,16 +2179,6 @@ spec:
properties:
certificateConfig:
description: Certificate configuration
anyOf:
- oneOf:
- required:
- certManager
- required:
- gardener
- not:
required:
- certManager
- gardener
properties:
certManager:
description: CertManager configuration
Expand All @@ -2224,6 +2204,11 @@ spec:
type: string
type: object
type: object
x-kubernetes-validations:
- message: at most one of the fields in [gardener certManager]
may be set
rule: '[has(self.gardener),has(self.certManager)].filter(x,x==true).size()
<= 1'
certificateManager:
description: Certificate manager which can be either `Default`
or `CertManager`
Expand All @@ -2235,6 +2220,11 @@ spec:
required:
- subscriptionServer
type: object
x-kubernetes-validations:
- message: exactly one of the fields in [dnsTarget ingressGatewayLabels]
must be set
rule: '[has(self.dnsTarget),has(self.ingressGatewayLabels)].filter(x,x==true).size()
== 1'
status:
properties:
appliedGeneration:
Expand Down
Loading