Documentation
¶
Overview ¶
Copyright 2025 HAProxy Technologies LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2025 HAProxy Technologies LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2025 HAProxy Technologies LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2025 HAProxy Technologies LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- type CertStorage
- type CertificateStorage
- type CertificateStorageDefault
- func (c *CertificateStorageDefault) CertListPath(listenerKey client.ObjectKey) futils.FilePath
- func (c *CertificateStorageDefault) CertPath(secretKey client.ObjectKey) futils.FilePath
- func (c *CertificateStorageDefault) DeleteCrtListFromDisk(crtListData certificate.CrtListData) error
- func (c *CertificateStorageDefault) DeleteEmptyCertsDir() error
- func (c *CertificateStorageDefault) DeleteFromDisk(certData certificate.CertificateData) error
- func (c *CertificateStorageDefault) NewCertificateData(secret *v1.Secret) (certificate.CertificateData, error)
- func (c *CertificateStorageDefault) NewCrtListData(listenerKey client.ObjectKey, secretKeys map[client.ObjectKey]struct{}) certificate.CrtListData
- func (c *CertificateStorageDefault) UpdateCrtListOnDisk(listenerKey client.ObjectKey, ...) error
- func (c *CertificateStorageDefault) WriteCrtListOnDisk(crtList certificate.CrtListData) error
- func (c *CertificateStorageDefault) WriteOnDisk(certData certificate.CertificateData) error
- type CrtListStorage
- type MapsStorage
- type MapsStorageDefault
- func (m *MapsStorageDefault) DeleteEmptyMapsDir() error
- func (MapsStorageDefault) DeleteFromDisk(data maps.MapData) error
- func (m *MapsStorageDefault) EnsureMapData(filePath futils.FilePath)
- func (m *MapsStorageDefault) GetMapData(filePath futils.FilePath) *maps.MapData
- func (m *MapsStorageDefault) GetMaps() map[string]*maps.MapData
- func (m *MapsStorageDefault) MapPath(frontendName string, mapName string) futils.FilePath
- func (MapsStorageDefault) WriteOnDisk(data maps.MapData) error
- type StructureType
Constants ¶
const ( PATH_EXACT_MAP = "path_exact" PATH_EXACT_DOMAIN_WILDCARD_MAP = "domain_wildcard_path_exact" PATH_PREFIX_MAP = "path_prefix" PATH_REGEX_MAP = "path_regex" SNI_MAP = "sni" SNI_DOMAIN_WILDCARD_MAP = "domain_wildcard_sni" )
const ( // StructureTypeCertDefault handles a default storage algorithm // Default algorithm for Certificate Storage // namespace/take two first characters of a secret name as folder // For example for secrets: namespace/secret-name-1 , namespace/secret-name-2, namespace/my-secret-name-1 // - /etc/unified.../certs/<namespace>/se/ // - /etc/unified.../certs/<namespace>/se/ // - /etc/unified.../certs/<namespace>/my/ StructureTypeCertDefault = "default" // StructureTypeMapsDefault handles a default storage algorithm // Default algorithm for Maps Storage // TODO StructureTypeMapsDefault = "default" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertStorage ¶
type CertStorage interface {
// CertPath returns the FilePath for the a Certificate
CertPath(secretKey client.ObjectKey) futils.FilePath
// NewCertificateData returns the new CertificateData for a given secret
NewCertificateData(secret *v1.Secret) (certificate.CertificateData, error)
WriteOnDisk(certData certificate.CertificateData) error
DeleteFromDisk(certData certificate.CertificateData) error
// DeleteEmptyCertsDir checks and deletes subdirectories directly
// under the certs Base Dir (namespace level)
DeleteEmptyCertsDir() error
}
type CertificateStorage ¶
type CertificateStorage interface {
CertStorage
CrtListStorage
}
func NewCertificateStorage ¶
func NewCertificateStorage(logger *slog.Logger, extractGVK utilsk8s.ExtractGVK, structureType StructureType, certsBaseDir, certFileBaseDir string) (CertificateStorage, error)
type CertificateStorageDefault ¶
type CertificateStorageDefault struct {
// CertsBaseDir the base directory to store certificates
// /usr/local/hug/certs/<namespace>/my/
CertsBaseDir string
// CertFilesBaseDir is the base directory where crt-list files are stored
CertFilesBaseDir string
// contains filtered or unexported fields
}
CertificateStorageDefault handles a default storage for certificates
func (*CertificateStorageDefault) CertListPath ¶
func (c *CertificateStorageDefault) CertListPath(listenerKey client.ObjectKey) futils.FilePath
func (*CertificateStorageDefault) CertPath ¶
func (c *CertificateStorageDefault) CertPath(secretKey client.ObjectKey) futils.FilePath
CertPath returns the FilePath for the a Certificate Default algorithm for Certificate Storage - For directory: certificates are grouped in directories based on:
- namespace/[take two first characters of a secret name as folder] to avoid having too many of them in the same directory For example for secrets: namespace/secret-name-1 , namespace/secret-name-2, namespace/my-secret-name-1 -/usr/local/hug/certs/<namespace>/se/ -/usr/local/hug/certs/<namespace>/se/ -/usr/local/hug/certs/<namespace>/my/
For file name: secret name.pem -/usr/local/hug/certs/<namespace>/se/secret-name-1.pem -/usr/local/hug/certs/<namespace>/se/secret-name-2.pem -/usr/local/hug/certs/<namespace>/my/my-secret-name-1.pem
func (*CertificateStorageDefault) DeleteCrtListFromDisk ¶
func (c *CertificateStorageDefault) DeleteCrtListFromDisk(crtListData certificate.CrtListData) error
func (*CertificateStorageDefault) DeleteEmptyCertsDir ¶
func (c *CertificateStorageDefault) DeleteEmptyCertsDir() error
DeleteEmptyCertsDir checks and deletes subdirectories directly under the certs BaseDir path if they are empty
func (*CertificateStorageDefault) DeleteFromDisk ¶
func (c *CertificateStorageDefault) DeleteFromDisk(certData certificate.CertificateData) error
func (*CertificateStorageDefault) NewCertificateData ¶
func (c *CertificateStorageDefault) NewCertificateData(secret *v1.Secret) (certificate.CertificateData, error)
func (*CertificateStorageDefault) NewCrtListData ¶
func (c *CertificateStorageDefault) NewCrtListData(listenerKey client.ObjectKey, secretKeys map[client.ObjectKey]struct{}) certificate.CrtListData
func (*CertificateStorageDefault) UpdateCrtListOnDisk ¶
func (*CertificateStorageDefault) WriteCrtListOnDisk ¶
func (c *CertificateStorageDefault) WriteCrtListOnDisk(crtList certificate.CrtListData) error
func (*CertificateStorageDefault) WriteOnDisk ¶
func (c *CertificateStorageDefault) WriteOnDisk(certData certificate.CertificateData) error
type CrtListStorage ¶
type CrtListStorage interface {
// CertListPath returns the FilePath for the crt-file file.
CertListPath(listenerKey client.ObjectKey) futils.FilePath
// DeleteCrtListFromDisk deletes a crt-list from disk
DeleteCrtListFromDisk(crtListData certificate.CrtListData) error
// NewCrtListData returns the new CrtListData
NewCrtListData(listenerKey client.ObjectKey, secretKeys map[client.ObjectKey]struct{}) certificate.CrtListData
// WriteCrtListOnDisk writes a new crt-list on disk
WriteCrtListOnDisk(crtList certificate.CrtListData) error
// UpdateCrtListOnDisk updates a crt-list on disk with new certificates and removed ones
UpdateCrtListOnDisk(gatewayKey client.ObjectKey, newSecretKeys, removedSecretKeys map[client.ObjectKey]struct{}) error
}
type MapsStorage ¶
type MapsStorage interface {
// MapPath returns the FilePath for a Map
MapPath(frontendName string, mapName string) futils.FilePath
// NewMapData returns the new Map
GetMapData(filePath futils.FilePath) *maps.MapData
EnsureMapData(filePath futils.FilePath)
GetMaps() map[string]*maps.MapData
WriteOnDisk(data maps.MapData) error
DeleteFromDisk(data maps.MapData) error
// DeleteEmptyMapsDir checks and deletes subdirectories directly
// under the maps Base Dir (namespace level)
DeleteEmptyMapsDir() error
}
func NewMapsStorage ¶
func NewMapsStorage(logger *slog.Logger, extractGVK utilsk8s.ExtractGVK, structureType StructureType, mapsBaseDir string) (MapsStorage, error)
type MapsStorageDefault ¶
type MapsStorageDefault struct {
Maps map[string]*maps.MapData
// MapsBaseDir the base directory to store maps
MapsBaseDir string
// contains filtered or unexported fields
}
func (*MapsStorageDefault) DeleteEmptyMapsDir ¶
func (m *MapsStorageDefault) DeleteEmptyMapsDir() error
func (MapsStorageDefault) DeleteFromDisk ¶
func (MapsStorageDefault) DeleteFromDisk(data maps.MapData) error
func (*MapsStorageDefault) EnsureMapData ¶
func (m *MapsStorageDefault) EnsureMapData(filePath futils.FilePath)
func (*MapsStorageDefault) GetMapData ¶
func (m *MapsStorageDefault) GetMapData(filePath futils.FilePath) *maps.MapData
func (*MapsStorageDefault) GetMaps ¶
func (m *MapsStorageDefault) GetMaps() map[string]*maps.MapData
func (*MapsStorageDefault) MapPath ¶
func (m *MapsStorageDefault) MapPath(frontendName string, mapName string) futils.FilePath
MapPath returns the FilePath for the map Default algorithm for Maps Storage - For directory: maps are grouped in directories based on:
- frontend_name
- /etc/unified.../maps/<frontend>/
func (MapsStorageDefault) WriteOnDisk ¶
func (MapsStorageDefault) WriteOnDisk(data maps.MapData) error
type StructureType ¶
type StructureType string