Skip to content
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

NETOBSERV-773 Copy certificates across namespaces #326

Merged
merged 3 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 11 additions & 3 deletions api/v1alpha1/flowcollector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,15 +573,17 @@ type OVNKubernetesConfig struct {
ContainerName string `json:"containerName,omitempty"`
}

type MountableType string

const (
CertRefTypeSecret = "secret"
CertRefTypeConfigMap = "configmap"
CertRefTypeSecret MountableType = "secret"
CertRefTypeConfigMap MountableType = "configmap"
)

type CertificateReference struct {
//+kubebuilder:validation:Enum=configmap;secret
// type for the certificate reference: "configmap" or "secret"
Type string `json:"type,omitempty"`
Type MountableType `json:"type,omitempty"`

// name of the config map or secret containing certificates
Name string `json:"name,omitempty"`
Expand All @@ -592,6 +594,12 @@ type CertificateReference struct {
// certKey defines the path to the certificate private key file name within the config map or secret. Omit when the key is not necessary.
// +optional
CertKey string `json:"certKey,omitempty"`

// namespace of the config map or secret containing certificates. If omitted, assumes same namespace as where NetObserv is deployed.
// If the namespace is different, the config map or the secret will be copied so that it can be mounted as required.
// +optional
//+kubebuilder:default:=""
Namespace string `json:"namespace,omitempty"`
}

// ClientTLS defines TLS client configuration
Expand Down
6 changes: 4 additions & 2 deletions api/v1alpha1/zz_generated.conversion.go

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

14 changes: 11 additions & 3 deletions api/v1beta1/flowcollector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,19 +641,27 @@ type OVNKubernetesConfig struct {
ContainerName string `json:"containerName,omitempty"`
}

type MountableType string

const (
CertRefTypeSecret = "secret"
CertRefTypeConfigMap = "configmap"
RefTypeSecret MountableType = "secret"
RefTypeConfigMap MountableType = "configmap"
)

type CertificateReference struct {
//+kubebuilder:validation:Enum=configmap;secret
// type for the certificate reference: "configmap" or "secret"
Type string `json:"type,omitempty"`
Type MountableType `json:"type,omitempty"`

// name of the config map or secret containing certificates
Name string `json:"name,omitempty"`

// namespace of the config map or secret containing certificates. If omitted, assumes same namespace as where NetObserv is deployed.
// If the namespace is different, the config map or the secret will be copied so that it can be mounted as required.
// +optional
//+kubebuilder:default:=""
Namespace string `json:"namespace,omitempty"`

// certFile defines the path to the certificate file name within the config map or secret
CertFile string `json:"certFile,omitempty"`

Expand Down
134 changes: 134 additions & 0 deletions bundle/manifests/flows.netobserv.io_flowcollectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,15 @@ spec:
description: name of the config map or secret containing
certificates
type: string
namespace:
default: ""
description: namespace of the config map or secret
containing certificates. If omitted, assumes same
namespace as where NetObserv is deployed. If the
namespace is different, the config map or the
secret will be copied so that it can be mounted
as required.
type: string
type:
description: 'type for the certificate reference:
"configmap" or "secret"'
Expand Down Expand Up @@ -1061,6 +1070,15 @@ spec:
description: name of the config map or secret containing
certificates
type: string
namespace:
default: ""
description: namespace of the config map or secret
containing certificates. If omitted, assumes same
namespace as where NetObserv is deployed. If the
namespace is different, the config map or the
secret will be copied so that it can be mounted
as required.
type: string
type:
description: 'type for the certificate reference:
"configmap" or "secret"'
Expand Down Expand Up @@ -1121,6 +1139,14 @@ spec:
description: name of the config map or secret containing
certificates
type: string
namespace:
default: ""
description: namespace of the config map or secret containing
certificates. If omitted, assumes same namespace as
where NetObserv is deployed. If the namespace is different,
the config map or the secret will be copied so that
it can be mounted as required.
type: string
type:
description: 'type for the certificate reference: "configmap"
or "secret"'
Expand Down Expand Up @@ -1157,6 +1183,14 @@ spec:
description: name of the config map or secret containing
certificates
type: string
namespace:
default: ""
description: namespace of the config map or secret containing
certificates. If omitted, assumes same namespace as
where NetObserv is deployed. If the namespace is different,
the config map or the secret will be copied so that
it can be mounted as required.
type: string
type:
description: 'type for the certificate reference: "configmap"
or "secret"'
Expand Down Expand Up @@ -1275,6 +1309,14 @@ spec:
description: name of the config map or secret containing
certificates
type: string
namespace:
default: ""
description: namespace of the config map or secret containing
certificates. If omitted, assumes same namespace as
where NetObserv is deployed. If the namespace is different,
the config map or the secret will be copied so that
it can be mounted as required.
type: string
type:
description: 'type for the certificate reference: "configmap"
or "secret"'
Expand Down Expand Up @@ -1311,6 +1353,14 @@ spec:
description: name of the config map or secret containing
certificates
type: string
namespace:
default: ""
description: namespace of the config map or secret containing
certificates. If omitted, assumes same namespace as
where NetObserv is deployed. If the namespace is different,
the config map or the secret will be copied so that
it can be mounted as required.
type: string
type:
description: 'type for the certificate reference: "configmap"
or "secret"'
Expand Down Expand Up @@ -1992,6 +2042,15 @@ spec:
description: name of the config map or secret
containing certificates
type: string
namespace:
default: ""
description: namespace of the config map or secret
containing certificates. If omitted, assumes
same namespace as where NetObserv is deployed.
If the namespace is different, the config map
or the secret will be copied so that it can
be mounted as required.
type: string
type:
description: 'type for the certificate reference:
"configmap" or "secret"'
Expand Down Expand Up @@ -3172,6 +3231,15 @@ spec:
description: name of the config map or secret containing
certificates
type: string
namespace:
default: ""
description: namespace of the config map or secret
containing certificates. If omitted, assumes same
namespace as where NetObserv is deployed. If the
namespace is different, the config map or the
secret will be copied so that it can be mounted
as required.
type: string
type:
description: 'type for the certificate reference:
"configmap" or "secret"'
Expand Down Expand Up @@ -3208,6 +3276,15 @@ spec:
description: name of the config map or secret containing
certificates
type: string
namespace:
default: ""
description: namespace of the config map or secret
containing certificates. If omitted, assumes same
namespace as where NetObserv is deployed. If the
namespace is different, the config map or the
secret will be copied so that it can be mounted
as required.
type: string
type:
description: 'type for the certificate reference:
"configmap" or "secret"'
Expand Down Expand Up @@ -3269,6 +3346,14 @@ spec:
description: name of the config map or secret containing
certificates
type: string
namespace:
default: ""
description: namespace of the config map or secret containing
certificates. If omitted, assumes same namespace as
where NetObserv is deployed. If the namespace is different,
the config map or the secret will be copied so that
it can be mounted as required.
type: string
type:
description: 'type for the certificate reference: "configmap"
or "secret"'
Expand Down Expand Up @@ -3305,6 +3390,14 @@ spec:
description: name of the config map or secret containing
certificates
type: string
namespace:
default: ""
description: namespace of the config map or secret containing
certificates. If omitted, assumes same namespace as
where NetObserv is deployed. If the namespace is different,
the config map or the secret will be copied so that
it can be mounted as required.
type: string
type:
description: 'type for the certificate reference: "configmap"
or "secret"'
Expand Down Expand Up @@ -3404,6 +3497,14 @@ spec:
description: name of the config map or secret containing
certificates
type: string
namespace:
default: ""
description: namespace of the config map or secret containing
certificates. If omitted, assumes same namespace as
where NetObserv is deployed. If the namespace is different,
the config map or the secret will be copied so that
it can be mounted as required.
type: string
type:
description: 'type for the certificate reference: "configmap"
or "secret"'
Expand Down Expand Up @@ -3440,6 +3541,14 @@ spec:
description: name of the config map or secret containing
certificates
type: string
namespace:
default: ""
description: namespace of the config map or secret containing
certificates. If omitted, assumes same namespace as
where NetObserv is deployed. If the namespace is different,
the config map or the secret will be copied so that
it can be mounted as required.
type: string
type:
description: 'type for the certificate reference: "configmap"
or "secret"'
Expand Down Expand Up @@ -3489,6 +3598,14 @@ spec:
description: name of the config map or secret containing
certificates
type: string
namespace:
default: ""
description: namespace of the config map or secret containing
certificates. If omitted, assumes same namespace as
where NetObserv is deployed. If the namespace is different,
the config map or the secret will be copied so that
it can be mounted as required.
type: string
type:
description: 'type for the certificate reference: "configmap"
or "secret"'
Expand Down Expand Up @@ -3525,6 +3642,14 @@ spec:
description: name of the config map or secret containing
certificates
type: string
namespace:
default: ""
description: namespace of the config map or secret containing
certificates. If omitted, assumes same namespace as
where NetObserv is deployed. If the namespace is different,
the config map or the secret will be copied so that
it can be mounted as required.
type: string
type:
description: 'type for the certificate reference: "configmap"
or "secret"'
Expand Down Expand Up @@ -4246,6 +4371,15 @@ spec:
description: name of the config map or secret
containing certificates
type: string
namespace:
default: ""
description: namespace of the config map or secret
containing certificates. If omitted, assumes
same namespace as where NetObserv is deployed.
If the namespace is different, the config map
or the secret will be copied so that it can
be mounted as required.
type: string
type:
description: 'type for the certificate reference:
"configmap" or "secret"'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ spec:
resources:
- configmaps
- namespaces
- secrets
- serviceaccounts
- services
verbs:
Expand All @@ -536,7 +537,6 @@ spec:
- ""
resources:
- endpoints
- secrets
verbs:
- get
- list
Expand Down
Loading