Skip to content

Commit 1e57116

Browse files
Merge pull request #693 from stuggi/ca_config
[tlse] update TLS/CA config
2 parents c311bb0 + f6f9c63 commit 1e57116

39 files changed

+663
-184
lines changed

apis/bases/core.openstack.org_openstackcontrolplanes.yaml

Lines changed: 74 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16182,20 +16182,84 @@ spec:
1618216182
type: object
1618316183
tls:
1618416184
default:
16185-
endpoint:
16185+
ingress:
16186+
ca:
16187+
duration: 43800h
16188+
cert:
16189+
duration: 8760h
16190+
enabled: true
16191+
podLevel:
16192+
enabled: false
1618616193
internal:
16187-
enabled: false
16188-
public:
16189-
enabled: true
16194+
ca:
16195+
duration: 43800h
16196+
cert:
16197+
duration: 8760h
16198+
ovn:
16199+
ca:
16200+
duration: 43800h
16201+
cert:
16202+
duration: 8760h
1619016203
properties:
1619116204
caBundleSecretName:
1619216205
type: string
16193-
endpoint:
16194-
additionalProperties:
16195-
properties:
16196-
enabled:
16197-
type: boolean
16198-
type: object
16206+
ingress:
16207+
properties:
16208+
ca:
16209+
properties:
16210+
duration:
16211+
type: string
16212+
renewBefore:
16213+
type: string
16214+
type: object
16215+
cert:
16216+
properties:
16217+
duration:
16218+
type: string
16219+
renewBefore:
16220+
type: string
16221+
type: object
16222+
enabled:
16223+
type: boolean
16224+
type: object
16225+
podLevel:
16226+
properties:
16227+
enabled:
16228+
type: boolean
16229+
internal:
16230+
properties:
16231+
ca:
16232+
properties:
16233+
duration:
16234+
type: string
16235+
renewBefore:
16236+
type: string
16237+
type: object
16238+
cert:
16239+
properties:
16240+
duration:
16241+
type: string
16242+
renewBefore:
16243+
type: string
16244+
type: object
16245+
type: object
16246+
ovn:
16247+
properties:
16248+
ca:
16249+
properties:
16250+
duration:
16251+
type: string
16252+
renewBefore:
16253+
type: string
16254+
type: object
16255+
cert:
16256+
properties:
16257+
duration:
16258+
type: string
16259+
renewBefore:
16260+
type: string
16261+
type: object
16262+
type: object
1619916263
type: object
1620016264
type: object
1620116265
required:

apis/core/v1beta1/openstackcontrolplane_types.go

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ type OpenStackControlPlaneSpec struct {
7575
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
7676

7777
// +kubebuilder:validation:Optional
78-
// +kubebuilder:default={endpoint: {public: {enabled: true}, internal: {enabled: false}}}
79-
//+operator-sdk:csv:customresourcedefinitions:type=spec
78+
// +operator-sdk:csv:customresourcedefinitions:type=spec
79+
// +kubebuilder:default={ingress: {enabled: true, ca: {duration: "43800h"}, cert: {duration: "8760h"}}, podLevel: {enabled: false, internal:{ca: {duration: "43800h"}, cert: {duration: "8760h"}}, ovn: {ca: {duration: "43800h"}, cert: {duration: "8760h"}}}}
8080
// TLS - Parameters related to the TLS
8181
TLS TLSSection `json:"tls"`
8282

@@ -189,8 +189,11 @@ type OpenStackControlPlaneSpec struct {
189189
type TLSSection struct {
190190
// +kubebuilder:validation:optional
191191
//+operator-sdk:csv:customresourcedefinitions:type=spec
192-
// The key must be the endpoint type (public, internal)
193-
Endpoint map[service.Endpoint]TLSEndpointConfig `json:"endpoint,omitempty"`
192+
Ingress TLSIngressConfig `json:"ingress,omitempty"`
193+
194+
// +kubebuilder:validation:optional
195+
//+operator-sdk:csv:customresourcedefinitions:type=spec
196+
PodLevel TLSPodLevelConfig `json:"podLevel,omitempty"`
194197

195198
// +kubebuilder:validation:optional
196199
//+operator-sdk:csv:customresourcedefinitions:type=spec
@@ -200,12 +203,67 @@ type TLSSection struct {
200203
tls.Ca `json:",inline"`
201204
}
202205

203-
// TLSEndpointConfig defines the desired state of TLSEndpoint configuration
204-
type TLSEndpointConfig struct {
206+
// TLSIngressConfig defines the desired state of the TLS configuration for the ingress configuration (route)
207+
type TLSIngressConfig struct {
205208
// +kubebuilder:validation:Optional
206209
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
207210
// Enabled - Whether TLS should be enabled for endpoint type
208211
Enabled bool `json:"enabled"`
212+
213+
// +kubebuilder:validation:optional
214+
//+operator-sdk:csv:customresourcedefinitions:type=spec
215+
CertSection `json:",inline"`
216+
}
217+
218+
// TLSPodLevelConfig defines the desired state of the TLS configuration for TLS termination at the pod level
219+
type TLSPodLevelConfig struct {
220+
// +kubebuilder:validation:Optional
221+
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
222+
// Enabled - Whether TLS should be enabled for endpoint type
223+
Enabled bool `json:"enabled"`
224+
225+
// +kubebuilder:validation:Optional
226+
// +operator-sdk:csv:customresourcedefinitions:type=spec
227+
// Internal - default CA used for all OpenStackControlPlane and OpenStackDataplane endpoints,
228+
// except OVN related CA and certs
229+
Internal CertSection `json:"internal,omitempty"`
230+
231+
// +kubebuilder:validation:Optional
232+
// +operator-sdk:csv:customresourcedefinitions:type=spec
233+
// Ovn - CA used for all OVN services on OpenStackControlPlane and OpenStackDataplane
234+
Ovn CertSection `json:"ovn,omitempty"`
235+
}
236+
237+
// CertSection defines details for CA config and its certs
238+
type CertSection struct {
239+
// +kubebuilder:validation:Optional
240+
// +operator-sdk:csv:customresourcedefinitions:type=spec
241+
// Cert - defines details for cert config
242+
Cert CertConfig `json:"cert,omitempty"`
243+
244+
// +kubebuilder:validation:Optional
245+
// +operator-sdk:csv:customresourcedefinitions:type=spec
246+
// Ca - defines details for CA cert config
247+
Ca CertConfig `json:"ca,omitempty"`
248+
}
249+
250+
// CertConfig defines details for cert configs
251+
type CertConfig struct {
252+
// The requested 'duration' (i.e. lifetime) of the Certificate.
253+
// The Certificate will be renewed either 2/3 through its duration or
254+
// `renewBefore` period before its expiry, whichever is later. Minimum
255+
// accepted duration is 1 hour. Value must be in units accepted by Go
256+
// time.ParseDuration https://golang.org/pkg/time/#ParseDuration
257+
// +optional
258+
Duration *metav1.Duration `json:"duration,omitempty"`
259+
260+
// How long before the currently issued certificate's expiry
261+
// cert-manager should renew the certificate. The default is 2/3 of the
262+
// issued certificate's duration. Minimum accepted value is 5 minutes.
263+
// Value must be in units accepted by Go time.ParseDuration
264+
// https://golang.org/pkg/time/#ParseDuration
265+
// +optional
266+
RenewBefore *metav1.Duration `json:"renewBefore,omitempty"`
209267
}
210268

211269
// DNSMasqSection defines the desired state of DNSMasq service
@@ -768,8 +826,12 @@ func SetupDefaults() {
768826
// Enabled - returns status of tls configuration for the passed in endpoint type
769827
func (t *TLSSection) Enabled(endpt service.Endpoint) bool {
770828
if t != nil {
771-
if cfg, ok := t.Endpoint[endpt]; ok && cfg.Enabled {
772-
return true
829+
switch endpt {
830+
case service.EndpointPublic:
831+
return t.Ingress.Enabled
832+
833+
case service.EndpointInternal:
834+
return t.PodLevel.Enabled
773835
}
774836
}
775837
return false

apis/core/v1beta1/zz_generated.deepcopy.go

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

apis/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ require (
1111
github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20240306142853-6b5d6005953d
1212
github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20240307055016-f66e43861199
1313
github.com/openstack-k8s-operators/horizon-operator/api v0.3.1-0.20240304130922-946bc7dd0996
14-
github.com/openstack-k8s-operators/infra-operator/apis v0.3.1-0.20240304123904-038a5ec77a70
14+
github.com/openstack-k8s-operators/infra-operator/apis v0.3.1-0.20240308113717-eaf5876d69c3
1515
github.com/openstack-k8s-operators/ironic-operator/api v0.3.1-0.20240229174131-28e3aee56d91
1616
github.com/openstack-k8s-operators/keystone-operator/api v0.3.1-0.20240307113114-033a606862c3
1717
github.com/openstack-k8s-operators/lib-common/modules/common v0.3.1-0.20240306153230-dc65ab49ebc0
1818
github.com/openstack-k8s-operators/lib-common/modules/storage v0.3.1-0.20240306153230-dc65ab49ebc0
1919
github.com/openstack-k8s-operators/manila-operator/api v0.3.1-0.20240305194401-0fda28a84acb
20-
github.com/openstack-k8s-operators/mariadb-operator/api v0.3.1-0.20240308154211-31e51e9ec6b4
20+
github.com/openstack-k8s-operators/mariadb-operator/api v0.3.1-0.20240308170012-6b04e3e9b9ee
2121
github.com/openstack-k8s-operators/neutron-operator/api v0.3.1-0.20240305155525-acb164bd7d67
2222
github.com/openstack-k8s-operators/nova-operator/api v0.3.1-0.20240307151724-2fc1351673af
2323
github.com/openstack-k8s-operators/octavia-operator/api v0.3.1-0.20240305155754-2dcd200b721a

apis/go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20240307055016-f66
8585
github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20240307055016-f66e43861199/go.mod h1:63UcRnUoHAyeXwUJa/6tmphZf4ScoY2+s7ItDV+m3BQ=
8686
github.com/openstack-k8s-operators/horizon-operator/api v0.3.1-0.20240304130922-946bc7dd0996 h1:+wkmeYGCYfbA+hoAIdShomyptqoqyJ33VYUxUaJoAVA=
8787
github.com/openstack-k8s-operators/horizon-operator/api v0.3.1-0.20240304130922-946bc7dd0996/go.mod h1:Hzq/OQJ/CC2HeohMw7jh3eqQpIf3FEC2kQSw48bWV+s=
88-
github.com/openstack-k8s-operators/infra-operator/apis v0.3.1-0.20240304123904-038a5ec77a70 h1:aLQuVEQKwV2nM4n232/7TnA50t5DD05deEvKyl6Gd5Y=
89-
github.com/openstack-k8s-operators/infra-operator/apis v0.3.1-0.20240304123904-038a5ec77a70/go.mod h1:yPqJ+WU8jApuDXNUjpTxMafihuZpX3Yik9ZXqGaxYBQ=
88+
github.com/openstack-k8s-operators/infra-operator/apis v0.3.1-0.20240308113717-eaf5876d69c3 h1:GJgS/TApDzvNj6lyEr1du6twi539QT2LOu5pqU0dZdA=
89+
github.com/openstack-k8s-operators/infra-operator/apis v0.3.1-0.20240308113717-eaf5876d69c3/go.mod h1:yPqJ+WU8jApuDXNUjpTxMafihuZpX3Yik9ZXqGaxYBQ=
9090
github.com/openstack-k8s-operators/ironic-operator/api v0.3.1-0.20240229174131-28e3aee56d91 h1:3yvrS33IOQibrXJJlVs/fDxLi5RCZlN5oDrR2c8aShk=
9191
github.com/openstack-k8s-operators/ironic-operator/api v0.3.1-0.20240229174131-28e3aee56d91/go.mod h1:Yac7wRClzl1/a7uBso4w8wq6Rjm+JLIouEsLre7VSDE=
9292
github.com/openstack-k8s-operators/keystone-operator/api v0.3.1-0.20240307113114-033a606862c3 h1:jMxdglPqLMuIM+s1aC1tYXz/NihB/BaMyutReg2fXpg=
@@ -99,8 +99,8 @@ github.com/openstack-k8s-operators/lib-common/modules/storage v0.3.1-0.202403061
9999
github.com/openstack-k8s-operators/lib-common/modules/storage v0.3.1-0.20240306153230-dc65ab49ebc0/go.mod h1:hKoDyLpp/Hc6fE1rYhlgXw8pYUPyRDKLgBrkAda5IPA=
100100
github.com/openstack-k8s-operators/manila-operator/api v0.3.1-0.20240305194401-0fda28a84acb h1:CdhjKduaBLkpXfpg9CfVssrewBYnsfTztIC7WlurAWk=
101101
github.com/openstack-k8s-operators/manila-operator/api v0.3.1-0.20240305194401-0fda28a84acb/go.mod h1:WjZonBUlokd/WM3bzlGqW0KncogYyxUDmWmKvxSPlLE=
102-
github.com/openstack-k8s-operators/mariadb-operator/api v0.3.1-0.20240308154211-31e51e9ec6b4 h1:SJT4etdZrncTpCDRyLG9oV9+dWVpngzxrSpcJeWzVuM=
103-
github.com/openstack-k8s-operators/mariadb-operator/api v0.3.1-0.20240308154211-31e51e9ec6b4/go.mod h1:f9IIyWeoskWoeWaDFF3qmAJ2Kqyovfi0Ar/QUfk3qag=
102+
github.com/openstack-k8s-operators/mariadb-operator/api v0.3.1-0.20240308170012-6b04e3e9b9ee h1:UYxzWJ1HixHQ+jPoZ/PeTqCUxVr1+kha4YJpV/UwL64=
103+
github.com/openstack-k8s-operators/mariadb-operator/api v0.3.1-0.20240308170012-6b04e3e9b9ee/go.mod h1:f9IIyWeoskWoeWaDFF3qmAJ2Kqyovfi0Ar/QUfk3qag=
104104
github.com/openstack-k8s-operators/neutron-operator/api v0.3.1-0.20240305155525-acb164bd7d67 h1:7BPdD7bAuzcl08/EiGDOJNBtfVnwuxm7F2acbC+kpuc=
105105
github.com/openstack-k8s-operators/neutron-operator/api v0.3.1-0.20240305155525-acb164bd7d67/go.mod h1:gOepjTKpq6rF0Lf69edviPOjFpjw4LHan/tWC4LB4Fs=
106106
github.com/openstack-k8s-operators/nova-operator/api v0.3.1-0.20240307151724-2fc1351673af h1:EuR34g9uahKG8YKp91FVvj5MNGR0Y+Q9aeu4Y3E8m+U=

0 commit comments

Comments
 (0)