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 DefaultLogwatchStream() string
- func GetClowderExternalURL(clowdConfig *clowder.AppConfig, existingUrl string) string
- func GetSaramaConfig() (*sarama.Config, error)
- func Load()
- func MetricsLevel() zerolog.Level
- func ProgramString() string
- func PulpConfigured() bool
- func RedisUrl() string
- func SetupCloudEventsKafkaClient(topic string) (v2.Client, error)
- func SetupNotifications()
- func SetupTemplateEvents()
- func SkipLogging(c echo.Context) bool
- func ValidArchLabel(label string) bool
- func ValidDistributionVersionLabels(labels []string) (bool, string)
- type Candlepin
- type Certs
- type Clients
- type Cloudwatch
- type Configuration
- type ContextRequestIDKey
- type Database
- type DistributionArch
- type DistributionVersion
- type Expiration
- type Feature
- type FeatureSet
- type Logging
- type Metrics
- type Mocks
- type ObjectStore
- type Options
- type PopularRepository
- type Pulp
- type Redis
- 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" )
const AARCH64 = "aarch64"
const ANY_ARCH = "any"
const ANY_VERSION = "any"
const (
ContentTypeRpm = "rpm"
)
const DefaultAppName = "content-sources"
const El7 = "7"
const El8 = "8"
const El9 = "9"
const FailedIntrospectionsLimit = 20
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 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"
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 DistributionVersions = [...]DistributionVersion{ { Name: "Any", Label: ANY_VERSION, }, { Name: "el7", Label: El7, }, { Name: "el8", Label: El8, }, { Name: "el9", Label: El9, }, }
var PopularRepos []PopularRepository
var RequeueableTasks = []string{DeleteTemplatesTask, DeleteRepositorySnapshotsTask, UpdateTemplateContentTask, DeleteSnapshotsTask}
var Tang *tangy.Tangy
var TasksToCleanup = []string{ IntrospectTask, RepositorySnapshotTask, UpdateTemplateContentTask, UpdateRepositoryTask, UpdateLatestSnapshotTask, AddUploadsTask, }
TasksToCleanup tasks that will get deleted, completed 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 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 CustomHTTPErrorHandler(err error, c echo.Context)
func DefaultLogwatchStream ¶
func DefaultLogwatchStream() string
func GetClowderExternalURL ¶
func GetSaramaConfig ¶
func MetricsLevel ¶
func ProgramString ¶
func ProgramString() string
func PulpConfigured ¶
func PulpConfigured() 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 SkipLogging(c echo.Context) bool
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 Certs ¶
type Certs struct { CertPath string `mapstructure:"cert_path"` CdnCertPair *tls.Certificate CdnCertPairString *string }
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 FeatureSet ¶
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 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"` }
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 CustomRepoContentGuards bool `mapstructure:"custom_repo_content_guards"` // To turn on or off the creation of content guards for custom repos Database Database `mapstructure:"database"` // for use with tangy }