Documentation ¶
Index ¶
- Constants
- Variables
- func APIIngressForCommonWebUI(instance *operatorsv1alpha1.CommonWebUI) *netv1.Ingress
- func BuildCertificate(instanceNamespace, instanceClusterIssuer string, certData CertificateData) *certmgr.Certificate
- func CallbackIngressForCommonWebUI(instance *operatorsv1alpha1.CommonWebUI) *netv1.Ingress
- func CommonConfigMapUI(instance *operatorsv1alpha1.LegacyHeader) *corev1.ConfigMap
- func CommonWebUIConfigMap(namespace string) *corev1.ConfigMap
- func ExtensionsConfigMapUI(namespace string, data map[string]string) *corev1.ConfigMap
- func GetImageID(imageRegistry, imageName, defaultImageVersion, imagePostfix, envVarName string) string
- func GetNavConfigContent() map[string]apiextv1beta.JSONSchemaProps
- func GetPodNames(pods []corev1.Pod) []string
- func GetServiceAccountName() string
- func IngressForLegacyUI(instance *operatorsv1alpha1.LegacyHeader) *netv1.Ingress
- func IsCertificateEqual(oldCertificate, newCertificate *certmgr.Certificate) bool
- func IsDaemonSetEqual(oldDaemonSet, newDaemonSet *appsv1.DaemonSet) bool
- func IsDeploymentEqual(oldDeployment, newDeployment *appsv1.Deployment) bool
- func IsIngressEqual(oldIngress, newIngress *netv1.Ingress) bool
- func IsServiceEqual(oldService, newService *corev1.Service) bool
- func LabelsForMetadata(deploymentName string) map[string]string
- func LabelsForPodMetadata(deploymentName string, crType string, crName string) map[string]string
- func LabelsForSelector(deploymentName string, crType string, crName string) map[string]string
- func Log4jsConfigMapUI(instance *operatorsv1alpha1.CommonWebUI) *corev1.ConfigMap
- func NavIngressForCommonWebUI(instance *operatorsv1alpha1.CommonWebUI) *netv1.Ingress
- func ReconcileCertificate(ctx context.Context, client client.Client, ...) error
- func ReconcileDaemonSet(ctx context.Context, client client.Client, instanceNamespace string, ...) error
- func ReconcileDeployment(ctx context.Context, client client.Client, instanceNamespace string, ...) error
- func ReconcileIngress(ctx context.Context, client client.Client, instanceNamespace string, ...) error
- func ReconcileService(ctx context.Context, client client.Client, instanceNamespace string, ...) error
- func ZenCardExtensionsConfigMapUI(name string, namespace string, version string, data map[string]string) *corev1.ConfigMap
- type CertificateData
Constants ¶
const APIIngress = "common-web-ui-api"
const CallbackIngress = "common-web-ui-callback"
const ChartName = "webui-nav"
const ChartVersion = "1.0.2"
const ClusterCaVolumeName = "cluster-ca"
const CommonConfigMap = "common-web-ui-config"
const CommonWebUICr = "common-web-ui-config"
const Cp4iCr = "icp4i"
const DaemonSetName = "common-web-ui"
const DefaultClusterIssuer = "cs-ca-issuer"
const DefaultImageName = "common-web-ui"
const DefaultImageRegistry = "quay.io/opencloudio"
const DefaultImageTag = "1.2.1"
const DefaultNamespace = "ibm-common-services"
const DeploymentName = "common-web-ui"
const ExtensionsConfigMap = "common-webui-ui-extensions"
const InternalTLSVolumeName = "internal-tls"
const LegacyImageName = "icp-platform-header"
const LegacyImageRegistry = "quay.io/opencloudio"
const LegacyImageTag = "3.2.4"
const LegacyReleaseName = "platform-header"
const Log4jsConfigMap = "common-web-ui-log4js"
const Log4jsVolumeName = "log4js"
const ReleaseName = "common-web-ui"
const ServiceName = "common-web-ui"
const UICertCommonName = "common-web-ui"
const UICertName = "common-web-ui-ca-cert"
UI certificate definition
const UICertSecretName = "common-web-ui-cert" + ""
use concatenation so linter won't complain about "Secret" vars
const UICertVolumeName = "common-web-ui-certs"
const ZenCardExtensionsConfigMap = "common-web-ui-zen-card-extensions"
const ZenProductConfigMapName = "product-configmap"
Config map values for the zen product-configmap to define meta api and endpoints
const ZenWalkmeExtensionsConfigMap = "common-web-ui-zen-walkme-extensions"
Variables ¶
var APIIngressAnnotations = map[string]string{
"kubernetes.io/ingress.class": "ibm-icp-management",
"icp.management.ibm.com/secure-backends": "true",
"icp.management.ibm.com/configuration-snippet": `
add_header 'X-XSS-Protection' '1' always;
add_header Content-Security-Policy "default-src 'none'; font-src 'unsafe-inline' 'self'; script-src 'unsafe-inline' 'self' blob: cdn.segment.com fast.appcues.com; connect-src 'self' https://api.segment.io wss://api.appcues.net https://notify.bugsnag.com; img-src * data:; frame-src 'self' https://my.appcues.com; style-src 'unsafe-inline' 'self' https://fast.appcues.com; frame-ancestors 'self'";
port_in_redirect off;`,
}
var ArchitectureList = []string{
"amd64",
"ppc64le",
"s390x",
}
var CallbackIngressAnnotations = map[string]string{
"kubernetes.io/ingress.class": "ibm-icp-management",
"icp.management.ibm.com/upstream-uri": "/auth/liberty/callback",
"icp.management.ibm.com/secure-backends": "true",
}
var ClusterCaVolume = corev1.Volume{ Name: ClusterCaVolumeName, VolumeSource: corev1.VolumeSource{ Secret: &corev1.SecretVolumeSource{ SecretName: "cs-ca-certificate-secret", Items: []corev1.KeyToPath{ { Key: "tls.key", Path: "ca.key", }, { Key: "tls.crt", Path: "ca.crt", }, }, Optional: &TrueVar, }, }, }
var CommonContainer = corev1.Container{ Image: "common-web-ui", Name: "common-web-ui", ImagePullPolicy: corev1.PullAlways, Resources: corev1.ResourceRequirements{ Limits: map[corev1.ResourceName]resource.Quantity{ corev1.ResourceCPU: *cpu300, corev1.ResourceMemory: *memory256}, Requests: map[corev1.ResourceName]resource.Quantity{ corev1.ResourceCPU: *cpu300, corev1.ResourceMemory: *memory256}, }, SecurityContext: &commonSecurityContext, ReadinessProbe: &corev1.Probe{ Handler: corev1.Handler{ HTTPGet: &corev1.HTTPGetAction{ Path: "/readinessProbe", Port: intstr.IntOrString{ Type: intstr.Int, IntVal: 3000, }, Scheme: corev1.URISchemeHTTPS, }, }, InitialDelaySeconds: 100, TimeoutSeconds: 15, PeriodSeconds: 10, SuccessThreshold: 1, FailureThreshold: 3, }, LivenessProbe: &corev1.Probe{ Handler: corev1.Handler{ HTTPGet: &corev1.HTTPGetAction{ Path: "/livenessProbe", Port: intstr.IntOrString{ Type: intstr.Int, IntVal: 3000, }, Scheme: corev1.URISchemeHTTPS, }, }, InitialDelaySeconds: 100, TimeoutSeconds: 5, PeriodSeconds: 30, SuccessThreshold: 1, FailureThreshold: 3, }, Env: []corev1.EnvVar{ { Name: "contextPath", Value: "/common-nav", }, { Name: "cfcRouterUrl", Value: "https://icp-management-ingress:443", }, { Name: "NODE_EXTRA_CA_CERTS", Value: " /opt/ibm/platform-header/certs/ca.crt", }, { Name: "PLATFORM_IDENTITY_PROVIDER_URL", Value: "https://icp-management-ingress:443/idprovider", }, { Name: "PLATFORM_AUTH_SERVICE_URL", Value: "https://icp-management-ingress:443/idauth", }, { Name: "NAV_PORT", Value: "8443", }, { Name: "OAUTH2_CLIENT_REGISTRATION_SECRET", ValueFrom: &corev1.EnvVarSource{ SecretKeyRef: &corev1.SecretKeySelector{ LocalObjectReference: corev1.LocalObjectReference{ Name: "platform-oidc-credentials", }, Key: "OAUTH2_CLIENT_REGISTRATION_SECRET", }, }, }, { Name: "CLOUDPAK_VERSION", Value: "1.0.0", }, { Name: "default_admin_user", Value: "admin", }, { Name: "CLUSTER_NAME", Value: "mycluster", }, { Name: "defaultAuth", Value: "", }, { Name: "enterpriseLDAP", Value: "", }, { Name: "enterpriseSAML", Value: "", }, { Name: "osAuth", Value: "", }, { Name: "SESSION_POLLING_INTERVAL", Value: "300", }, { Name: "PREFERRED_LOGIN", ValueFrom: &corev1.EnvVarSource{ ConfigMapKeyRef: &corev1.ConfigMapKeySelector{ LocalObjectReference: corev1.LocalObjectReference{ Name: "platform-auth-idp", }, Key: "PREFERRED_LOGIN", }, }, }, { Name: "ROKS_ENABLED", ValueFrom: &corev1.EnvVarSource{ ConfigMapKeyRef: &corev1.ConfigMapKeySelector{ LocalObjectReference: corev1.LocalObjectReference{ Name: "platform-auth-idp", }, Key: "ROKS_ENABLED", }, }, }, { Name: "WLP_CLIENT_ID", ValueFrom: &corev1.EnvVarSource{ SecretKeyRef: &corev1.SecretKeySelector{ LocalObjectReference: corev1.LocalObjectReference{ Name: "platform-oidc-credentials", }, Key: "WLP_CLIENT_ID", }, }, }, { Name: "WLP_CLIENT_SECRET", ValueFrom: &corev1.EnvVarSource{ SecretKeyRef: &corev1.SecretKeySelector{ LocalObjectReference: corev1.LocalObjectReference{ Name: "platform-oidc-credentials", }, Key: "WLP_CLIENT_SECRET", }, }, }, { Name: "USE_HTTPS", Value: "true", }, { Name: "UI_SSL_CA", Value: "/certs/common-web-ui/ca.crt", }, { Name: "UI_SSL_CERT", Value: "/certs/common-web-ui/tls.crt", }, { Name: "UI_SSL_KEY", Value: "/certs/common-web-ui/tls.key", }, { Name: "LANDING_PAGE", Value: "", }, { Name: "WATCH_NAMESPACE", ValueFrom: &corev1.EnvVarSource{ ConfigMapKeyRef: &corev1.ConfigMapKeySelector{ LocalObjectReference: corev1.LocalObjectReference{ Name: "namespace-scope", }, Key: "namespaces", }, }, }, { Name: "POD_NAMESPACE", ValueFrom: &corev1.EnvVarSource{ FieldRef: &corev1.ObjectFieldSelector{ FieldPath: "metadata.namespace", }, }, }, { Name: "USE_ZEN", Value: "false", }, { Name: "APP_VERSION", Value: "", }, }, }
var CommonLegacyIngressAnnotations = map[string]string{
"kubernetes.io/ingress.class": "ibm-icp-management",
"icp.management.ibm.com/auth-type": "access-token",
"icp.management.ibm.com/configuration-snippet": `
add_header 'X-XSS-Protection' '1' always;
add_header Content-Security-Policy "default-src 'none'; font-src * 'unsafe-inline' 'self' data:; script-src 'unsafe-inline' 'self' blob: cdn.segment.com fast.appcues.com; connect-src 'self' https://api.segment.io wss://api.appcues.net https://notify.bugsnag.com; img-src * data:; frame-src 'self' https://my.appcues.com; style-src 'unsafe-inline' 'self' https://fast.appcues.com; frame-ancestors 'self'";`,
}
var CommonUIIngressAnnotations = map[string]string{
"kubernetes.io/ingress.class": "ibm-icp-management",
"icp.management.ibm.com/auth-type": "access-token",
"icp.management.ibm.com/secure-backends": "true",
"icp.management.ibm.com/app-root": "/common-nav?root=true",
"icp.management.ibm.com/configuration-snippet": `
add_header 'X-XSS-Protection' '1' always;
add_header Content-Security-Policy "default-src 'none'; font-src * 'unsafe-inline' 'self' data:; script-src 'unsafe-inline' 'self' blob: cdn.segment.com fast.appcues.com; connect-src 'self' https://api.segment.io wss://api.appcues.net https://notify.bugsnag.com; img-src * data:; frame-src 'self' https://my.appcues.com; style-src 'unsafe-inline' 'self' https://fast.appcues.com; frame-ancestors 'self' https://*.multicloud-ibm.com";`,
}
var CrTemplates = `` /* 263-byte string literal not displayed */
var CrTemplates2 = `` /* 267-byte string literal not displayed */
var DeamonSetAnnotations = map[string]string{
"scheduler.alpha.kubernetes.io/critical-pod": "",
"productName": "IBM Cloud Platform Common Services",
"productID": "068a62892a1e4db39641342e592daa25",
"productMetric": "FREE",
}
var DefaultStatusForCR = []string{"none"}
var DeploymentAnnotations = map[string]string{
"scheduler.alpha.kubernetes.io/critical-pod": "",
"productName": "IBM Cloud Platform Common Services",
"productID": "068a62892a1e4db39641342e592daa25",
"productMetric": "FREE",
}
var Extensions = `` /* 328-byte string literal not displayed */
var FalseVar = false
var InternalTLSVolume = corev1.Volume{ Name: InternalTLSVolumeName, VolumeSource: corev1.VolumeSource{ Secret: &corev1.SecretVolumeSource{ SecretName: "internal-tls", Items: []corev1.KeyToPath{ { Key: "tls.key", Path: "ca.key", }, { Key: "ca.crt", Path: "ca.crt", }, }, Optional: &TrueVar, }, }, }
var Log4jsData = map[string]string{
"log4js.json": ` {
"appenders": {
"console": {
"type": "console",
"layout": {
"type": "pattern",
"pattern": "[%d] [%p] [webui-nav] [%c] %m"
}
}
},
"categories": {
"default": { "appenders": ["console"], "level": "info" },
"request": { "appenders": ["console"], "level": "error" },
"socket.io": { "appenders": ["console"], "level": "error" },
"status": { "appenders": ["console"], "level": "info" },
"watcher": { "appenders": ["console"], "level": "debug" },
"service-watcher": { "appenders": ["console"], "level": "error" },
"session-poller": { "appenders": ["console"], "level": "error" },
"service-discovery": { "appenders": ["console"], "level": "info" },
"service-account": { "appenders": ["console"], "level": "info" },
"version": { "appenders": ["console"], "level": "error" },
"user-mgmt-client": { "appenders": ["console"], "level": "error" },
"oidc-client": { "appenders": ["console"], "level": "error" },
"server": { "appenders": ["console"], "level": "info" },
"auth": { "appenders": ["console"], "level": "error" },
"logout": { "appenders": ["console"], "level": "error" },
"app": { "appenders": ["console"], "level": "error" },
"userMgmt": { "appenders": ["console"], "level": "error" },
"catalog-client": { "appenders": ["console"], "level": "error" },
"template": { "appenders": ["console"], "level": "error" }
}
}`,
}
var Log4jsVolume = corev1.Volume{ Name: Log4jsVolumeName, VolumeSource: corev1.VolumeSource{ ConfigMap: &corev1.ConfigMapVolumeSource{ LocalObjectReference: corev1.LocalObjectReference{ Name: "common-web-ui-log4js", }, Items: []corev1.KeyToPath{ { Key: "log4js.json", Path: "log4js.json", }, }, Optional: &TrueVar, }, }, }
nolint
nolint
var Replica1 int32 = 1
var Seconds60 int64 = 60
var TrueVar = true
var UICertVolume = corev1.Volume{ Name: UICertVolumeName, VolumeSource: corev1.VolumeSource{ Secret: &corev1.SecretVolumeSource{ SecretName: UICertSecretName, Optional: &TrueVar, }, }, }
var UICertificateData = CertificateData{ Name: UICertName, Secret: UICertSecretName, Common: UICertCommonName, App: "common-web-ui", Component: "common-web-ui", }
var ZenCardExtensions = `` /* 10396-byte string literal not displayed */
var ZenNginxConfig = `` /* 294-byte string literal not displayed */
var ZenPcmMap = map[string]string{
"CLOUD_PAK_TYPE": "admin",
"CLOUD_PAK_URL": "https://common-web-ui:3000/common-nav/zen/meta",
"CLOUD_PAK_AUTH_URL": "https://common-web-ui:3000/common-nav/zen/meta",
"IBM_PRODUCT_NAME": "IBM Cloud Pak | Administration",
"IBM_DEFAULT_PRODUCT_NAME": "IBM Cloud Pak | Administration",
}
var ZenWalkmeExtensions = `` /* 756-byte string literal not displayed */
Functions ¶
func APIIngressForCommonWebUI ¶
func APIIngressForCommonWebUI(instance *operatorsv1alpha1.CommonWebUI) *netv1.Ingress
func BuildCertificate ¶
func BuildCertificate(instanceNamespace, instanceClusterIssuer string, certData CertificateData) *certmgr.Certificate
func CallbackIngressForCommonWebUI ¶
func CallbackIngressForCommonWebUI(instance *operatorsv1alpha1.CommonWebUI) *netv1.Ingress
func CommonConfigMapUI ¶
func CommonConfigMapUI(instance *operatorsv1alpha1.LegacyHeader) *corev1.ConfigMap
func CommonWebUIConfigMap ¶ added in v1.10.0
func ExtensionsConfigMapUI ¶
func GetImageID ¶
func GetImageID(imageRegistry, imageName, defaultImageVersion, imagePostfix, envVarName string) string
GetImageID constructs image IDs for operands: either <IMAGE_NAME>:<IMAGE_TAG> or <IMAGE_NAME>@<IMAGE_SHA>
func GetNavConfigContent ¶
func GetNavConfigContent() map[string]apiextv1beta.JSONSchemaProps
GetNavConfigContent returns all nav config crd content
func GetPodNames ¶
GetPodNames returns the pod names of the array of pods passed in
func GetServiceAccountName ¶
func GetServiceAccountName() string
returns the service account name or default if it is not set in the environment
func IngressForLegacyUI ¶
func IngressForLegacyUI(instance *operatorsv1alpha1.LegacyHeader) *netv1.Ingress
func IsCertificateEqual ¶
func IsCertificateEqual(oldCertificate, newCertificate *certmgr.Certificate) bool
Use DeepEqual to determine if 2 certificates are equal. Check ObjectMeta and Spec. If there are any differences, return false. Otherwise, return true.
func IsDaemonSetEqual ¶
Use DeepEqual to determine if 2 daemon sets are equal. Check labels, pod template labels, service account names, volumes, containers, init containers, image name, volume mounts, env vars, liveness, readiness. If there are any differences, return false. Otherwise, return true.
func IsDeploymentEqual ¶
func IsDeploymentEqual(oldDeployment, newDeployment *appsv1.Deployment) bool
Use DeepEqual to determine if 2 deployments are equal. Check labels, replicas, pod template labels, service account names, volumes, containers, init containers, image name, volume mounts, env vars, liveness, readiness. If there are any differences, return false. Otherwise, return true. oldDeployment is the deployment that is currently running. newDeployment is what we expect the deployment to look like.
func IsIngressEqual ¶
Use DeepEqual to determine if 2 ingresses are equal. Check ObjectMeta and Spec. If there are any differences, return false. Otherwise, return true.
func IsServiceEqual ¶
Use DeepEqual to determine if 2 services are equal. Check ObjectMeta, Ports and Selector. If there are any differences, return false. Otherwise, return true.
func LabelsForMetadata ¶
returns the labels associated with the resource being created
func LabelsForPodMetadata ¶
returns the labels associated with the Pod being created
func LabelsForSelector ¶
returns the labels for selecting the resources belonging to the given metering CR name
func Log4jsConfigMapUI ¶
func Log4jsConfigMapUI(instance *operatorsv1alpha1.CommonWebUI) *corev1.ConfigMap
func NavIngressForCommonWebUI ¶
func NavIngressForCommonWebUI(instance *operatorsv1alpha1.CommonWebUI) *netv1.Ingress
func ReconcileCertificate ¶
func ReconcileCertificate(ctx context.Context, client client.Client, instanceNamespace, certificateName string, newCertificate *certmgr.Certificate, needToRequeue *bool) error
Check if the Certificates already exist, if not create new ones.
func ReconcileDaemonSet ¶
func ReconcileDaemonSet(ctx context.Context, client client.Client, instanceNamespace string, daemonSetName string, newDaemonSet *appsv1.DaemonSet, needToRequeue *bool) error
Check if a DaemonSet already exists. If not, create a new one.
func ReconcileDeployment ¶
func ReconcileDeployment(ctx context.Context, client client.Client, instanceNamespace string, deploymentName string, newDeployment *appsv1.Deployment, needToRequeue *bool) error
Check if a DaemonSet already exists. If not, create a new one.
func ReconcileIngress ¶
func ReconcileIngress(ctx context.Context, client client.Client, instanceNamespace string, ingressName string, newIngress *netv1.Ingress, needToRequeue *bool) error
Check if the Ingress already exists, if not create a new one.