Documentation
¶
Index ¶
- Constants
- Variables
- func CDNCertDaysTillExpiration() (int, error)
- func CandlepinConfigured() bool
- func ClowderS3Url(c clowder.ObjectStoreConfig) string
- func ConfigureCertificate() (*tls.Certificate, *string, error)
- func ConfigureLogging()
- func ConfigureTang() error
- func CustomHTTPErrorHandler(err error, c echo.Context)
- func DBLevel() zerolog.Level
- func DaysTillExpiration(certs *tls.Certificate) (int, error)
- func DefaultLogwatchStream() string
- func EnvironmentPrefix(rhContentPath, rhDomainName, templateUUID string) (string, error)
- func FeatureAccessible(ctx context.Context, feature Feature) bool
- func FeatureServiceConfigured() bool
- func GetCertificate(certUser CertUser) (tls.Certificate, error)
- func GetClowderExternalURL(clowdConfig *clowder.AppConfig, existingUrl string) string
- func GetHTTPClient(certUser CertUser, configClientCerts bool) (http.Client, error)
- func GetSaramaConfig() (*sarama.Config, error)
- func GetTransport(certBytes, keyBytes, caCertBytes []byte, certUser CertUser, ...) (*http.Transport, error)
- func KesselConfigured() bool
- func Load()
- func MetricsLevel() zerolog.Level
- func ProgramString() string
- func PulpConfigured() bool
- func ReadCACert(certUser CertUser) ([]byte, error)
- func ReadCert(certUser CertUser) ([]byte, error)
- func ReadKey(certUser CertUser) ([]byte, error)
- func RedisUrl() string
- func RoadmapConfigured() bool
- func SetupCloudEventsKafkaClient(topic string) (v2.Client, error)
- func SetupNotifications()
- func SetupTemplateEvents()
- func SkipLogging(c echo.Context) bool
- func SnapshotInterval(redHat bool) string
- func ValidArchLabel(label string) bool
- func ValidDistributionMinorVersionLabel(label string) bool
- func ValidDistributionVersionLabels(labels []string) (bool, string)
- func ValidExtendedReleaseLabel(label string) bool
- type Candlepin
- type CandlepinCertUser
- func (c *CandlepinCertUser) CACert() string
- func (c *CandlepinCertUser) CACertPath() string
- func (c *CandlepinCertUser) ClientCert() string
- func (c *CandlepinCertUser) ClientCertPath() string
- func (c *CandlepinCertUser) ClientKey() string
- func (c *CandlepinCertUser) ClientKeyPath() string
- func (c *CandlepinCertUser) Label() string
- func (c *CandlepinCertUser) Proxy() string
- type CertUser
- type Certs
- type Clients
- type Cloudwatch
- type Configuration
- type ContextRequestIDKey
- type Database
- type DistributionArch
- type DistributionMinorVersion
- type DistributionVersion
- type Expiration
- type Feature
- type FeatureService
- type FeatureServiceCertUser
- func (c *FeatureServiceCertUser) CACert() string
- func (c *FeatureServiceCertUser) CACertPath() string
- func (c *FeatureServiceCertUser) ClientCert() string
- func (c *FeatureServiceCertUser) ClientCertPath() string
- func (c *FeatureServiceCertUser) ClientKey() string
- func (c *FeatureServiceCertUser) ClientKeyPath() string
- func (c *FeatureServiceCertUser) Label() string
- func (c *FeatureServiceCertUser) Proxy() string
- type FeatureSet
- type Kessel
- type KesselAuth
- type Logging
- type Metrics
- type MockKessel
- type Mocks
- type ObjectStore
- type Options
- type PopularRepository
- type Pulp
- type PulpCertUser
- func (c *PulpCertUser) CACert() string
- func (c *PulpCertUser) CACertPath() string
- func (c *PulpCertUser) ClientCert() string
- func (c *PulpCertUser) ClientCertPath() string
- func (c *PulpCertUser) ClientKey() string
- func (c *PulpCertUser) ClientKeyPath() string
- func (c *PulpCertUser) Label() string
- func (c *PulpCertUser) Proxy() string
- type PulpLogParser
- type Redis
- type RequestIdHook
- type Roadmap
- type Sentry
- type Tasking
Constants ¶
const ( DefaultPagedRpmInsertsLimit = 500 DefaultIntrospectApiTimeLimitSec = 30 )
const ( RepositorySnapshotTask = "snapshot" // Task to create a snapshot for a repository config DeleteRepositorySnapshotsTask = "delete-repository-snapshots" // Task to delete all snapshots for a repository config DeleteSnapshotsTask = "delete-snapshots" // Task to delete all snapshots marked for deletion IntrospectTask = "introspect" // Task to introspect repository DeleteTemplatesTask = "delete-templates" // Task to delete all content templates marked for deletion UpdateTemplateContentTask = "update-template-content" // Task to update the pulp distributions of a template's snapshots UpdateRepositoryTask = "update-repository" // Task to update repository information in candlepin when the repository is updated AddUploadsTask = "add-uploads-repository" // Task to add uploaded files/artifacts to a repository UpdateLatestSnapshotTask = "update-latest-snapshot" // Task to update templates to use the latest snapshot of a repository )
const ( TaskStatusRunning = "running" // Task is running TaskStatusFailed = "failed" // Task has failed TaskStatusCompleted = "completed" // Task has completed TaskStatusCanceled = "canceled" // Task has been canceled TaskStatusPending = "pending" // Task is waiting to be started )
const ( StatusValid = "Valid" // Repository introspected successfully StatusInvalid = "Invalid" // Repository has never introspected due to error StatusPending = "Pending" // Repository not introspected yet. )
const ( OriginExternal = "external" OriginRedHat = "red_hat" OriginUpload = "upload" OriginCommunity = "community" )
const ( EPEL10Url = "https://dl.fedoraproject.org/pub/epel/10/Everything/x86_64/" EPEL9Url = "https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/" EPEL8Url = "https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/" )
const AARCH64 = "aarch64"
const ANY_ARCH = "any"
const ANY_VERSION = "any"
const CommunityDomainName = "cs-community"
const CommunityOrg = "-2"
const (
ContentTypeRpm = "rpm"
)
const DefaultAppName = "content-sources"
const E4S = "e4s"
const EEUS = "eeus"
const EUS = "eus"
const El10 = "10"
const El7 = "7"
const El8 = "8"
const El9 = "9"
const FailedIntrospectionsLimit = 20
const FailedSnapshotLimit = 10 // Number of times to retry a snapshot before stopping
const HeaderRequestId = "x-rh-insights-request-id" // the header that contains the request ID
const IntrospectTimeInterval = time.Hour * 23
const ObjectTypeRepository = "repository"
const ObjectTypeTemplate = "template"
const PPC64LE = "ppc64le"
const RedHatDomainName = "cs-redhat" // Note the RH domain name may not be set to this in all environments
const RedHatGpgKeyPath = "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release"
const RedHatOrg = "-1"
const RepoClowderBucketName = "content-sources-central-pulp-s3"
const RequestIdLoggingKey = "request_id" // the key that represents the request ID when logged
const RhCertEnv = "RH_CDN_CERT_PAIR"
This is for passing the certificate and key directly, not the file path.
const S390x = "s390x"
const STORAGE_TYPE_LOCAL = "local"
const STORAGE_TYPE_OBJECT = "object"
const SnapshotForceInterval = 24 // In hours
const X8664 = "x86_64"
Variables ¶
var CancellableTasks = []string{IntrospectTask, RepositorySnapshotTask, UpdateTemplateContentTask}
var DistributionArches = [...]DistributionArch{ { Name: "Any", Label: ANY_ARCH, }, { Name: "aarch64", Label: AARCH64, }, { Name: "ppc64le", Label: PPC64LE, }, { Name: "s390x", Label: S390x, }, { Name: "x86_64", Label: X8664, }, }
var DistributionMinorVersions = [...]DistributionMinorVersion{ {Name: "RHEL 8.6", Label: "8.6", Major: El8, ExtendedReleaseStreams: []string{E4S}}, {Name: "RHEL 8.8", Label: "8.8", Major: El8, ExtendedReleaseStreams: []string{E4S}}, {Name: "RHEL 9.0", Label: "9.0", Major: El9, ExtendedReleaseStreams: []string{E4S, EEUS}}, {Name: "RHEL 9.2", Label: "9.2", Major: El9, ExtendedReleaseStreams: []string{E4S, EEUS}}, {Name: "RHEL 9.4", Label: "9.4", Major: El9, ExtendedReleaseStreams: []string{EUS, E4S, EEUS}}, {Name: "RHEL 9.6", Label: "9.6", Major: El9, ExtendedReleaseStreams: []string{EUS, E4S, EEUS}}, {Name: "RHEL 10.0", Label: "10.0", Major: El10, ExtendedReleaseStreams: []string{EUS, EEUS}}, }
var DistributionVersions = [...]DistributionVersion{ { Name: "Any", Label: ANY_VERSION, }, { Name: "RHEL 7", Label: El7, }, { Name: "RHEL 8", Label: El8, }, { Name: "RHEL 9", Label: El9, }, { Name: "RHEL 10", Label: El10, }, }
var EPELUrls = []string{EPEL10Url, EPEL9Url, EPEL8Url}
var ExtendedReleaseLabelToFeature = map[[2]string]string{ {EUS, X8664}: "RHEL-EUS-x86_64", {EUS, AARCH64}: "RHEL-EUS-aarch64", {E4S, X8664}: "RHEL-E4S-x86_64", {EEUS, X8664}: "RHEL-EEUS-x86_64", {EEUS, AARCH64}: "RHEL-EEUS-aarch64", }
var ExtendedReleaseStreamNames = map[string]string{ EUS: "Extended Update Support (EUS)", E4S: "Update Services for SAP Solutions (E4S)", EEUS: "Enhanced Extended Update Support (EEUS)", }
ExtendedReleaseStreamNames maps stream labels to display names
var MemoPulpLastSuccessfulPulpLogParse = "last_successful_pulp_log_date"
Memo Keys
var PopularRepos []PopularRepository
var RequeueableTasks = []string{DeleteTemplatesTask, DeleteRepositorySnapshotsTask, UpdateTemplateContentTask, DeleteSnapshotsTask}
var SubscriptionFeaturesIgnored = []string{"RHEL-OS-x86_64", ""}
Features that do not currently use a subscription check, available to all users
var Tang *tangy.Tangy
var TaskTypes = []string{ RepositorySnapshotTask, DeleteRepositorySnapshotsTask, DeleteSnapshotsTask, IntrospectTask, DeleteTemplatesTask, UpdateTemplateContentTask, UpdateRepositoryTask, AddUploadsTask, UpdateLatestSnapshotTask, }
var TasksToCleanup = []string{ IntrospectTask, RepositorySnapshotTask, UpdateTemplateContentTask, UpdateRepositoryTask, UpdateLatestSnapshotTask, AddUploadsTask, }
TasksToCleanup tasks that will get deleted, completed, canceled or failed, if older than 20 days
var TasksToCleanupIfCompleted = []string{DeleteRepositorySnapshotsTask, DeleteTemplatesTask, DeleteSnapshotsTask}
TasksToCleanupIfCompleted tasks that will get deleted if older than 10 days, only if status is completed
Functions ¶
func CandlepinConfigured ¶
func CandlepinConfigured() bool
func ClowderS3Url ¶
func ClowderS3Url(c clowder.ObjectStoreConfig) string
func ConfigureCertificate ¶
func ConfigureCertificate() (*tls.Certificate, *string, error)
ConfigureCertificate loads in a cert keypair from either, an environment variable if specified, or a file path (see configs/config.yaml.example) If no certificate is specified, we return no error however if a certificate is specified but cannot be loaded an error is returned.
func ConfigureLogging ¶
func ConfigureLogging()
func ConfigureTang ¶
func ConfigureTang() error
func CustomHTTPErrorHandler ¶
func DaysTillExpiration ¶
func DaysTillExpiration(certs *tls.Certificate) (int, error)
DaysTillExpiration Finds the number of days until the specified certificate expired tls.Certificate allows for multiple certs to be combined, so this takes the expiration date that is coming the soonest
func DefaultLogwatchStream ¶
func DefaultLogwatchStream() string
func EnvironmentPrefix ¶
EnvironmentPrefix create the prefix for the candlepin environment for a template
Red Hat content is appended to an environment prefix
for example "content/dist/rhel9/9.4/x86_64/appstream/os/" would end up prefixed with /api/pulp/content/$REDHAT_DOMAIN/templates/$TEMPLATE_UUID
func FeatureServiceConfigured ¶
func FeatureServiceConfigured() bool
func GetCertificate ¶
func GetCertificate(certUser CertUser) (tls.Certificate, error)
func GetClowderExternalURL ¶
func GetHTTPClient ¶
func GetSaramaConfig ¶
func GetTransport ¶
func KesselConfigured ¶
func KesselConfigured() bool
func MetricsLevel ¶
func ProgramString ¶
func ProgramString() string
func PulpConfigured ¶
func PulpConfigured() bool
func ReadCACert ¶
func RoadmapConfigured ¶
func RoadmapConfigured() bool
func SetupCloudEventsKafkaClient ¶
SetupCloudEventsKafkaClient create the cloud event kafka client that will send event to the given kafka topic
func SetupNotifications ¶
func SetupNotifications()
SetupNotifications creates the cloud event kafka client for sending event to the event service
func SetupTemplateEvents ¶
func SetupTemplateEvents()
SetupTemplateEvents creates the cloud event kafka client for sending event to the patch service
func SkipLogging ¶
func SnapshotInterval ¶
func ValidArchLabel ¶
ValidArchLabel Given a label, verifies that the label is a valid distribution architecture label
func ValidDistributionVersionLabels ¶
ValidDistributionVersionLabels Given a list of labels, return true if every item of the list is a valid distribution version. If at least one is not valid, returns false and the first invalid version
Types ¶
type CandlepinCertUser ¶
type CandlepinCertUser struct {
}
func (*CandlepinCertUser) CACert ¶
func (c *CandlepinCertUser) CACert() string
func (*CandlepinCertUser) CACertPath ¶
func (c *CandlepinCertUser) CACertPath() string
func (*CandlepinCertUser) ClientCert ¶
func (c *CandlepinCertUser) ClientCert() string
func (*CandlepinCertUser) ClientCertPath ¶
func (c *CandlepinCertUser) ClientCertPath() string
func (*CandlepinCertUser) ClientKey ¶
func (c *CandlepinCertUser) ClientKey() string
func (*CandlepinCertUser) ClientKeyPath ¶
func (c *CandlepinCertUser) ClientKeyPath() string
func (*CandlepinCertUser) Label ¶
func (c *CandlepinCertUser) Label() string
func (*CandlepinCertUser) Proxy ¶
func (c *CandlepinCertUser) Proxy() string
type CertUser ¶
type Certs ¶
type Certs struct {
CertPath string `mapstructure:"cert_path"`
CdnCertPair *tls.Certificate
CdnCertPairString *string
}
type Clients ¶
type Clients struct {
RbacEnabled bool `mapstructure:"rbac_enabled"`
RbacBaseUrl string `mapstructure:"rbac_base_url"`
RbacTimeout int `mapstructure:"rbac_timeout"`
Kessel Kessel `mapstructure:"kessel"`
Pulp Pulp `mapstructure:"pulp"`
Redis Redis `mapstructure:"redis"`
Candlepin Candlepin `mapstructure:"candlepin"`
FeatureService FeatureService `mapstructure:"feature_service"`
PulpLogParser PulpLogParser `mapstructure:"pulp_log_parser"`
Roadmap Roadmap `mapstructure:"roadmap"`
}
type Cloudwatch ¶
type Configuration ¶
type Configuration struct {
Database Database
Logging Logging
Loaded bool
Certs Certs
Options Options
Kafka kafka.KafkaConfig
Cloudwatch Cloudwatch
Metrics Metrics
Clients Clients `mapstructure:"clients"`
Mocks Mocks `mapstructure:"mocks"`
Sentry Sentry `mapstructure:"sentry"`
NotificationsClient cloudevents.Client `mapstructure:"notification_client"`
TemplateEventClient cloudevents.Client `mapstructure:"template_event_client"`
Tasking Tasking `mapstructure:"tasking"`
Features FeatureSet `mapstructure:"features"`
}
var LoadedConfig Configuration
func Get ¶
func Get() *Configuration
type ContextRequestIDKey ¶
type ContextRequestIDKey struct{}
Used in the context as the Key to store the Request ID type ContextRequestIDKey struct{}
type DistributionArch ¶
type DistributionVersion ¶
type Expiration ¶
type FeatureService ¶
type FeatureService struct {
Server string
ClientCert string `mapstructure:"client_cert"`
ClientKey string `mapstructure:"client_key"`
CACert string `mapstructure:"ca_cert"`
ClientCertPath string `mapstructure:"client_cert_path"`
ClientKeyPath string `mapstructure:"client_key_path"`
CACertPath string `mapstructure:"ca_cert_path"`
}
type FeatureServiceCertUser ¶
type FeatureServiceCertUser struct {
}
func (*FeatureServiceCertUser) CACert ¶
func (c *FeatureServiceCertUser) CACert() string
func (*FeatureServiceCertUser) CACertPath ¶
func (c *FeatureServiceCertUser) CACertPath() string
func (*FeatureServiceCertUser) ClientCert ¶
func (c *FeatureServiceCertUser) ClientCert() string
func (*FeatureServiceCertUser) ClientCertPath ¶
func (c *FeatureServiceCertUser) ClientCertPath() string
func (*FeatureServiceCertUser) ClientKey ¶
func (c *FeatureServiceCertUser) ClientKey() string
func (*FeatureServiceCertUser) ClientKeyPath ¶
func (c *FeatureServiceCertUser) ClientKeyPath() string
func (*FeatureServiceCertUser) Label ¶
func (c *FeatureServiceCertUser) Label() string
func (*FeatureServiceCertUser) Proxy ¶
func (c *FeatureServiceCertUser) Proxy() string
type FeatureSet ¶
type FeatureSet struct {
Snapshots Feature
AdminTasks Feature `mapstructure:"admin_tasks"`
CommunityRepos Feature `mapstructure:"community_repos"`
Kessel Feature `mapstructure:"kessel"`
AllowCustomEPELCreation Feature `mapstructure:"allow_custom_epel_creation"`
ExtendedReleaseRepos Feature `mapstructure:"extended_release_repos"`
}
type Kessel ¶
type Kessel struct {
Server string `mapstructure:"server"`
Auth KesselAuth `mapstructure:"auth"`
Timeout time.Duration `mapstructure:"timeout"`
}
type KesselAuth ¶
type Metrics ¶
type Metrics struct {
// Defines the path to the metrics server that the app should be configured to
// listen on for metric traffic.
Path string `mapstructure:"path"`
// Defines the metrics port that the app should be configured to listen on for
// metric traffic.
Port int `mapstructure:"port"`
// How often (in seconds) to run queries to collect some metrics
CollectionFrequency int `mapstructure:"collection_frequency"`
}
type MockKessel ¶
type Mocks ¶
type Mocks struct {
Namespace string `mapstructure:"namespace"`
Rbac struct {
UserReadWrite []string `mapstructure:"user_read_write"`
UserRead []string `mapstructure:"user_read"`
UserNoPermissions []string `mapstructure:"user_no_permissions"`
} `mapstructure:"rbac"`
Kessel MockKessel `mapstructure:"kessel"`
}
type ObjectStore ¶
type Options ¶
type Options struct {
PagedRpmInsertsLimit int `mapstructure:"paged_rpm_inserts_limit"`
IntrospectApiTimeLimitSec int `mapstructure:"introspect_api_time_limit_sec"`
// If true, introspection and snapshotting always runs for nightly job invocation, regardless of how soon they happened previously. Used for testing.
AlwaysRunCronTasks bool `mapstructure:"always_run_cron_tasks"`
EnableNotifications bool `mapstructure:"enable_notifications"`
TemplateEventTopic string `mapstructure:"template_event_topic"`
RepositoryImportFilter string `mapstructure:"repository_import_filter"` // Used by qe to control which repos are imported
// url (https://servername) to access the api, used to reference gpg keys
// Supports partial hostnames (i.e. http://.server.example.com).
// If this is encountered (and clowder is used), it will prepend the envName from clowder
ExternalURL string `mapstructure:"external_url"`
SnapshotRetainDaysLimit int `mapstructure:"snapshot_retain_days_limit"`
FeatureFilter []string `mapstructure:"feature_filter"` // Used to control which repos are imported based on feature name
EntitleAll bool `mapstructure:"entitle_all"` // Used in ephemeral to allow access to all layered repos
}
https://stackoverflow.com/questions/54844546/how-to-unmarshal-golang-viper-snake-case-values
type PopularRepository ¶
type PopularRepository struct {
UUID string `json:"uuid"` // UUID of the repository if it exists for the user
ExistingName string `json:"existing_name"` // Existing reference name for repository
SuggestedName string `json:"suggested_name"` // Suggested name of the popular repository
URL string `json:"url"` // URL of the remote yum repository
DistributionVersions []string `json:"distribution_versions" example:"7,8"` // Versions to restrict client usage to
DistributionArch string `json:"distribution_arch" example:"x86_64"` // Architecture to restrict client usage to
GpgKey string `json:"gpg_key"` // GPG key for repository
MetadataVerification bool `json:"metadata_verification"` // Verify packages
}
Should match api.PopularRepositoryResponse
type Pulp ¶
type Pulp struct {
Server string
Username string
Password string
StorageType string `mapstructure:"storage_type"` // s3 or local
CustomRepoObjects *ObjectStore `mapstructure:"custom_repo_objects"`
DownloadPolicy string `mapstructure:"download_policy"` // on_demand or immediate
GuardSubjectDn string `mapstructure:"guard_subject_dn"` // DN to allow access to via x509 identity subject_dn
RepoContentGuards bool `mapstructure:"custom_repo_content_guards"` // To turn on or off the creation of content guards for repos
Database Database `mapstructure:"database"` // for use with tangy
ClientCert string `mapstructure:"client_cert"`
ClientKey string `mapstructure:"client_key"`
CACert string `mapstructure:"ca_cert"`
ClientCertPath string `mapstructure:"client_cert_path"`
ClientKeyPath string `mapstructure:"client_key_path"`
CACertPath string `mapstructure:"ca_cert_path"`
ContentOrigin string `mapstructure:"content_origin"` // hostname of the location of pulp content
Proxy string `mapstructure:"proxy"`
}
type PulpCertUser ¶
type PulpCertUser struct{}
func (*PulpCertUser) CACert ¶
func (c *PulpCertUser) CACert() string
func (*PulpCertUser) CACertPath ¶
func (c *PulpCertUser) CACertPath() string
func (*PulpCertUser) ClientCert ¶
func (c *PulpCertUser) ClientCert() string
func (*PulpCertUser) ClientCertPath ¶
func (c *PulpCertUser) ClientCertPath() string
func (*PulpCertUser) ClientKey ¶
func (c *PulpCertUser) ClientKey() string
func (*PulpCertUser) ClientKeyPath ¶
func (c *PulpCertUser) ClientKeyPath() string
func (*PulpCertUser) Label ¶
func (c *PulpCertUser) Label() string
func (*PulpCertUser) Proxy ¶
func (c *PulpCertUser) Proxy() string
type PulpLogParser ¶
type PulpLogParser struct {
Cloudwatch Cloudwatch `mapstructure:"cloudwatch"`
S3 ObjectStore `mapstructure:"s3"`
}
type RequestIdHook ¶
type RequestIdHook struct{}