resources

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const APIIngress = "common-web-ui-api"
View Source
const CallbackIngress = "common-web-ui-callback"
View Source
const ChartName = "webui-nav"
View Source
const ChartVersion = "1.0.2"
View Source
const ClusterCaVolumeName = "cluster-ca"
View Source
const CommonConfigMap = "common-web-ui-config"
View Source
const CommonWebUICr = "common-web-ui-config"
View Source
const Cp4iCr = "icp4i"
View Source
const DaemonSetName = "common-web-ui"
View Source
const DefaultClusterIssuer = "cs-ca-issuer"
View Source
const DefaultImageName = "common-web-ui"
View Source
const DefaultImageRegistry = "quay.io/opencloudio"
View Source
const DefaultImageTag = "1.2.1"
View Source
const DefaultNamespace = "ibm-common-services"
View Source
const DeploymentName = "common-web-ui"
View Source
const ExtensionsConfigMap = "common-webui-ui-extensions"
View Source
const InternalTLSVolumeName = "internal-tls"
View Source
const LegacyImageName = "icp-platform-header"
View Source
const LegacyImageRegistry = "quay.io/opencloudio"
View Source
const LegacyImageTag = "3.2.4"
View Source
const LegacyReleaseName = "platform-header"
View Source
const Log4jsConfigMap = "common-web-ui-log4js"
View Source
const Log4jsVolumeName = "log4js"
View Source
const NavIngress = "common-web-ui"
View Source
const ReleaseName = "common-web-ui"
View Source
const ServiceName = "common-web-ui"
View Source
const UICertCommonName = "common-web-ui"
View Source
const UICertName = "common-web-ui-ca-cert"

UI certificate definition

View Source
const UICertSecretName = "common-web-ui-cert" + ""

use concatenation so linter won't complain about "Secret" vars

View Source
const UICertVolumeName = "common-web-ui-certs"
View Source
const ZenCardExtensionsConfigMap = "common-web-ui-zen-card-extensions"
View Source
const ZenProductConfigMapName = "product-configmap"

Config map values for the zen product-configmap to define meta api and endpoints

View Source
const ZenQuickNavExtensionsConfigMap = "common-web-ui-zen-quicknav-extensions"
View Source
const ZenWalkmeExtensionsConfigMap = "common-web-ui-zen-walkme-extensions"

Variables

View Source
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;`,
}
View Source
var ArchitectureList = []string{
	"amd64",
	"ppc64le",
	"s390x",
}
View Source
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",
}
View Source
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,
		},
	},
}
View Source
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: "",
		},
	},
}
View Source
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'";`,
}
View Source
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";`,
}
View Source
var CrTemplates = `` /* 263-byte string literal not displayed */
View Source
var CrTemplates2 = `` /* 267-byte string literal not displayed */
View Source
var DeamonSetAnnotations = map[string]string{
	"scheduler.alpha.kubernetes.io/critical-pod": "",
	"productName":   "IBM Cloud Platform Common Services",
	"productID":     "068a62892a1e4db39641342e592daa25",
	"productMetric": "FREE",
}
View Source
var DefaultStatusForCR = []string{"none"}
View Source
var DeploymentAnnotations = map[string]string{
	"scheduler.alpha.kubernetes.io/critical-pod": "",
	"productName":   "IBM Cloud Platform Common Services",
	"productID":     "068a62892a1e4db39641342e592daa25",
	"productMetric": "FREE",
}
View Source
var Extensions = `` /* 328-byte string literal not displayed */
View Source
var FalseVar = false
View Source
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,
		},
	},
}
View Source
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" }
		}
	  }`,
}
View Source
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,
		},
	},
}
View Source
var NavConfigCP4ICR = `` /* 2441-byte string literal not displayed */

nolint

View Source
var NavConfigCR = `` /* 8626-byte string literal not displayed */

nolint

View Source
var Replica1 int32 = 1
View Source
var Seconds60 int64 = 60
View Source
var TrueVar = true
View Source
var UICertVolume = corev1.Volume{
	Name: UICertVolumeName,
	VolumeSource: corev1.VolumeSource{
		Secret: &corev1.SecretVolumeSource{
			SecretName: UICertSecretName,
			Optional:   &TrueVar,
		},
	},
}
View Source
var UICertificateData = CertificateData{
	Name:      UICertName,
	Secret:    UICertSecretName,
	Common:    UICertCommonName,
	App:       "common-web-ui",
	Component: "common-web-ui",
}
View Source
var ZenCardExtensions = `` /* 10396-byte string literal not displayed */
View Source
var ZenNginxConfig = `` /* 294-byte string literal not displayed */
View Source
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",
}
View Source
var ZenQuickNavExtensions = `` /* 646-byte string literal not displayed */
View Source
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 CommonWebUIConfigMap(namespace string) *corev1.ConfigMap

func ExtensionsConfigMapUI

func ExtensionsConfigMapUI(namespace string, data map[string]string) *corev1.ConfigMap

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

func GetPodNames(pods []corev1.Pod) []string

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

func IsDaemonSetEqual(oldDaemonSet, newDaemonSet *appsv1.DaemonSet) bool

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

func IsIngressEqual(oldIngress, newIngress *netv1.Ingress) bool

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

func IsServiceEqual(oldService, newService *corev1.Service) bool

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

func LabelsForMetadata(deploymentName string) map[string]string

returns the labels associated with the resource being created

func LabelsForPodMetadata

func LabelsForPodMetadata(deploymentName string, crType string, crName string) map[string]string

returns the labels associated with the Pod being created

func LabelsForSelector

func LabelsForSelector(deploymentName string, crType string, crName string) map[string]string

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(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.

func ReconcileService

func ReconcileService(ctx context.Context, client client.Client, instanceNamespace string, serviceName string,
	newService *corev1.Service, needToRequeue *bool) error

Check if a Service already exists. If not, create a new one.

func ZenCardExtensionsConfigMapUI added in v1.9.0

func ZenCardExtensionsConfigMapUI(name string, namespace string, version string, data map[string]string) *corev1.ConfigMap

Types

type CertificateData

type CertificateData struct {
	Name      string
	Secret    string
	Common    string
	App       string
	Component string
}

Jump to

Keyboard shortcuts

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