managed

package
v0.0.99 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2020 License: UPL-1.0 Imports: 67 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// IstioNamespace namespace name for istio system
	IstioNamespace = "istio-system"
	// IstioPrometheusCMName config map name for istio prometheus
	IstioPrometheusCMName = "prometheus"
	// PrometheusYml Prometheus config file
	PrometheusYml = "prometheus.yml"
	// PrometheusLabel app label for Prometheus
	PrometheusLabel = "app=prometheus"

	// PrometheusScrapeConfigsLabel label for Prometheus scrape config
	PrometheusScrapeConfigsLabel = "scrape_configs"
	// PrometheusJobNameLabel label for Prometheus job name
	PrometheusJobNameLabel = "job_name"
	// BasicAuthLabel label for Prometheus basic auth
	BasicAuthLabel = "basic_auth"
	// UsernameLabel label for Prometheus username
	UsernameLabel = "username"
	// PasswordLabel label for Prometheus password
	PasswordLabel = "password"

	// JobNameHolder placeholder for job name
	JobNameHolder = "##JOB_NAME##"
	// NamespaceHolder placeholder for namespace
	NamespaceHolder = "##NAMESPACE##"
	// KeepSourceLabelsHolder placeholder for keep source labels
	KeepSourceLabelsHolder = "##KEEP_SOURCE_LABELS##"
	// KeepSourceLabelsRegexHolder placeholder for keep source labels regex
	KeepSourceLabelsRegexHolder = "##KEEP_SOURCE_LABELS_REGEX##"
	// ComponentBindingNameHolder placeholder for component binding name
	ComponentBindingNameHolder = "##COMPONENT_BINDING_NAME##"

	// NodeExporterName name for system Node Exporter
	NodeExporterName = "system-node-exporter"
	// NodeExporterNamespace namespace for Node Exporter
	NodeExporterNamespace = "monitoring"
	// NodeExporterKeepSourceLabels keep source labels for Node Exporter
	NodeExporterKeepSourceLabels = "__meta_kubernetes_pod_label_app"
	// NodeExporterKeepSourceLabelsRegex keep source labels regex for Node Exporter
	NodeExporterKeepSourceLabelsRegex = "node-exporter"

	// WeblogicOperatorName name for WebLogic operator
	WeblogicOperatorName = "weblogic-operator"
	// WeblogicOperatorKeepSourceLabels keep source labels for WebLogic operator
	WeblogicOperatorKeepSourceLabels = "__meta_kubernetes_pod_label_app"
	// WeblogicOperatorKeepSourceLabelsRegex keep source labels regex for WebLogic operator
	WeblogicOperatorKeepSourceLabelsRegex = "weblogic-operator"
	// WeblogicName name for WebLogic
	WeblogicName = "weblogic"
	// WeblogicKeepSourceLabels keep source labels for WebLogic
	WeblogicKeepSourceLabels = "__meta_kubernetes_pod_annotation_prometheus_io_scrape,__meta_kubernetes_pod_label_weblogic_domainName"
	// WeblogicKeepSourceLabelsRegex keep source labels regex for WebLogic
	WeblogicKeepSourceLabelsRegex = "true;##COMPONENT_BINDING_NAME##"

	// CoherenceOperatorName name for Coherence operator
	CoherenceOperatorName = "coherence-operator"
	// CoherenceOperatorKeepSourceLabels keep source labels for Coherence operator
	CoherenceOperatorKeepSourceLabels = "__meta_kubernetes_pod_label_app,__meta_kubernetes_pod_container_port_name"
	// CoherenceOperatorKeepSourceLabelsRegex keep source labels regex for Coherence operator
	CoherenceOperatorKeepSourceLabelsRegex = "coherence-operator;(metrics|oper-metrics)"
	// CoherenceName name for Coherence
	CoherenceName = "coherence"
	// CoherenceKeepSourceLabels keep source labels for Coherence
	CoherenceKeepSourceLabels = "__meta_kubernetes_pod_annotation_prometheus_io_scrape,__meta_kubernetes_pod_label_coherenceCluster"
	// CoherenceKeepSourceLabelsRegex keep source labels regex for Coherence
	CoherenceKeepSourceLabelsRegex = "true;##COMPONENT_BINDING_NAME##"

	// HelidonName name for Helidon
	HelidonName = "helidon"
	// HelidonKeepSourceLabels keep source labels for Helidon
	HelidonKeepSourceLabels = "__meta_kubernetes_pod_annotation_prometheus_io_scrape,__meta_kubernetes_pod_label_app"
	// HelidonKeepSourceLabelsRegex keep source labels regex for Helidon
	HelidonKeepSourceLabelsRegex = "true;##COMPONENT_BINDING_NAME##"
)
View Source
const IstioSystemNamespace = "istio-system"

IstioSystemNamespace constant for the istio namespace.

View Source
const PrometheusScrapeConfigTemplate = `` /* 830-byte string literal not displayed */

PrometheusScrapeConfigTemplate configuration for general prometheus scrape target template.

Variables

This section is empty.

Functions

func AddToNamespace

func AddToNamespace(nsMap map[string]map[string]struct{}, ns string, value string)

AddToNamespace adds a value to a set for a given namespace map.

func BuildManagedClusterConnection

func BuildManagedClusterConnection(kubeConfigContents []byte, stopCh <-chan struct{}) (*util.ManagedClusterConnection, error)

BuildManagedClusterConnection builds a ManagedClusterConnection for the given KubeConfig contents.

func CleanupOrphanedClusterRoleBindings

func CleanupOrphanedClusterRoleBindings(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection, allMbPairs map[string]*types.ModelBindingPair) error

CleanupOrphanedClusterRoleBindings deletes cluster role bindings that have been orphaned.

func CleanupOrphanedClusterRoles

func CleanupOrphanedClusterRoles(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection, allMbPairs map[string]*types.ModelBindingPair) error

CleanupOrphanedClusterRoles deletes cluster roles that have been orphaned.

func CleanupOrphanedConfigMaps

func CleanupOrphanedConfigMaps(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection) error

CleanupOrphanedConfigMaps deletes config maps that have been orphaned.

func CleanupOrphanedCustomResources

func CleanupOrphanedCustomResources(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection, stopCh <-chan struct{}) error

CleanupOrphanedCustomResources deletes custom resources that have been orphaned.

func CleanupOrphanedIngresses

func CleanupOrphanedIngresses(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection) error

CleanupOrphanedIngresses deletes istio gateways and virtual services that have been orphaned.

func CleanupOrphanedNamespaces

func CleanupOrphanedNamespaces(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection, allMbPairs map[string]*types.ModelBindingPair) error

CleanupOrphanedNamespaces deletes namespaces that have been orphaned.

func CleanupOrphanedServiceEntries

func CleanupOrphanedServiceEntries(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection) error

CleanupOrphanedServiceEntries deletes istio service entries that have been orphaned.

func CreateAuthorizationPolicies

func CreateAuthorizationPolicies(mbPair *types.ModelBindingPair, filteredConnections map[string]*util.ManagedClusterConnection) error

CreateAuthorizationPolicies creates/updates istio authorization policies for managed clusters.

func CreateClusterRoleBindings

func CreateClusterRoleBindings(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection) error

CreateClusterRoleBindings creates/updates cluster role bindings needed for each managed cluster.

func CreateClusterRoles

func CreateClusterRoles(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection) error

CreateClusterRoles creates/updates cluster roles needed for each managed cluster.

func CreateConfigMaps

func CreateConfigMaps(mbPair *types.ModelBindingPair, filteredConnections map[string]*util.ManagedClusterConnection) error

CreateConfigMaps creates/updates config maps needed for each managed cluster.

func CreateCrdDefinitions

func CreateCrdDefinitions(managedClusterConnection *util.ManagedClusterConnection, managedCluster *v1beta1v8o.VerrazzanoManagedCluster, manifest *util.Manifest) error

CreateCrdDefinitions creates/updates custom resource definitions needed for each managed cluster.

func CreateCustomResources

func CreateCustomResources(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection, stopCh <-chan struct{}, vbLister listers.VerrazzanoBindingLister) error

CreateCustomResources creates/updates custome resources needed for each managed cluster.

func CreateDaemonSets

func CreateDaemonSets(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection, verrazzanoURI string) error

CreateDaemonSets creates/updates daemon sets needed for each managed cluster.

func CreateDeployments

func CreateDeployments(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection, manifest *util.Manifest, verrazzanoURI string, sec monitoring.Secrets) error

CreateDeployments creates/updates deployments needed for each managed cluster.

func CreateDestinationRules

func CreateDestinationRules(mbPair *types.ModelBindingPair, filteredConnections map[string]*util.ManagedClusterConnection) error

CreateDestinationRules creates/updates istio destination rules for managed clusters.

func CreateIngresses

func CreateIngresses(mbPair *types.ModelBindingPair, filteredConnections map[string]*util.ManagedClusterConnection) error

CreateIngresses creates/updates istio gateways and virtual services for managed clusters.

func CreateNamespaces

func CreateNamespaces(mbPair *types.ModelBindingPair, filteredConnections map[string]*util.ManagedClusterConnection) error

CreateNamespaces creates/updates namespaces needed for each managed cluster.

func CreateSecrets

func CreateSecrets(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection, kubeClientSet kubernetes.Interface, sec monitoring.Secrets) error

CreateSecrets will go through a ModelBindingPair and find all of the secrets that are needed by components, and it will then check if those secrets exist in the correct namespaces and clusters, and then update or create them as needed

func CreateServiceAccounts

func CreateServiceAccounts(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection) error

CreateServiceAccounts creates/updates service accounts needed for each managed cluster.

func CreateServiceEntries

func CreateServiceEntries(mbPair *types.ModelBindingPair, filteredConnections map[string]*util.ManagedClusterConnection, availableManagedClusterConnections map[string]*util.ManagedClusterConnection) error

CreateServiceEntries creates/updates istio service entries for managed clusters.

func CreateServices

func CreateServices(mbPair *types.ModelBindingPair, filteredConnections map[string]*util.ManagedClusterConnection) error

CreateServices creates/updates services needed for each managed cluster.

func DeleteClusterRoleBindings

func DeleteClusterRoleBindings(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection, bindingLabel bool) error

DeleteClusterRoleBindings deletes cluster role bindings for a given binding.

func DeleteClusterRoles

func DeleteClusterRoles(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection, bindingLabel bool) error

DeleteClusterRoles deletes cluster roles for a given binding.

func DeleteCustomResources

func DeleteCustomResources(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection) error

DeleteCustomResources deletes custom resources for a given binding.

func DeleteNamespaces

func DeleteNamespaces(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection, bindingLabel bool) error

DeleteNamespaces deletes namespaces for a given binding.

func GetDomainAdminServerNameAsInAddress added in v0.0.99

func GetDomainAdminServerNameAsInAddress() string

GetDomainAdminServerNameAsInAddress returns Weblogic domain admin server name for service.

func GetDomainAdminServerNameAsInTarget added in v0.0.99

func GetDomainAdminServerNameAsInTarget() string

GetDomainAdminServerNameAsInTarget returns Weblogic domain admin server name for target.

func GetFilteredConnections

func GetFilteredConnections(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection) (map[string]*util.ManagedClusterConnection, error)

GetFilteredConnections given a map of available ManagedClusterConnections, returns a filtered set of those NOT applicable to the given VerrazzanoBinding.

func GetNamespaceValues

func GetNamespaceValues(nsMap map[string]map[string]struct{}, ns string) []string

GetNamespaceValues returns the set of values for a given namespace and map.

func UpdateIstioPrometheusConfigMaps

func UpdateIstioPrometheusConfigMaps(mbPair *types.ModelBindingPair, secretLister corev1listers.SecretLister, availableManagedClusterConnections map[string]*util.ManagedClusterConnection) error

UpdateIstioPrometheusConfigMaps updates the istio prometheus scrape configs to include all the node exporter endpoints in monitoring namespace.

func UpdateIstioPrometheusConfigMapsForBinding

func UpdateIstioPrometheusConfigMapsForBinding(mbPair *types.ModelBindingPair, secretLister corev1listers.SecretLister, clusterConnections map[string]*util.ManagedClusterConnection) error

UpdateIstioPrometheusConfigMapsForBinding updates the istio prometheus scrape configs to include all the component endpoints from a given verrazzano model binding pair. Different scrape targets/jobs will be added to differentiate the binding/cluster/namespace/component/componentBinding combinations. job_name: <binding_name>_<cluster_name>_<namespace>_<component_name>_<component_binding_name>

For examples:

# weblogic binding
myvb_poc-managed-1_weblogic-operator (one per managed cluster per verrazzano binding if needed)
myvb_poc-managed-1_myapps_weblogic_my-bookstore-ui
myvb_poc-managed-1_myapps_weblogic_my-bookstore-backend

# helidon binding
myvb_poc-managed-1_myapps_helidon_my-stock-app

# coherence binding
myvb_poc-managed-1_myapps_coherence-operator (one per namespace if needed)
myvb_poc-managed-1_myapps_coherence_my-cache-app

func UpdateIstioPrometheusConfigMapsForNodeExporter

func UpdateIstioPrometheusConfigMapsForNodeExporter(mbPair *types.ModelBindingPair, availableManagedClusterConnections map[string]*util.ManagedClusterConnection) error

UpdateIstioPrometheusConfigMapsForNodeExporter updates the istio prometheus scrape configs to include all the node exporter endpoints in monitoring namespace.

Types

type ScrapeConfigInfo

type ScrapeConfigInfo struct {
	PrometheusScrapeTargetJobName string
	Namespace                     string
	KeepSourceLabels              string
	KeepSourceLabelsRegex         string
	BindingName                   string
	ComponentBindingName          string
	ManagedClusterName            string
	Username                      string
	Password                      string
}

ScrapeConfigInfo contains configuration for scraping metrics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL