resources

package
v1.1.0-cambridge Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: Apache-2.0 Imports: 16 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 DaemonSetName = "common-web-ui"
View Source
const DefaultImageName = "common-web-ui"
View Source
const DefaultImageRegistry = "quay.io/opencloudio"
View Source
const DefaultImageTag = "1.1.0"
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"

Variables

View Source
var APIIngressAnnotations = map[string]string{
	"kubernetes.io/ingress.class": "ibm-icp-management",

	"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'";`,
}
View Source
var CallbackIngressAnnotations = map[string]string{
	"kubernetes.io/ingress.class":         "ibm-icp-management",
	"icp.management.ibm.com/upstream-uri": "/auth/liberty/callback",
}
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: "",
			},
		},
		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: "",
			},
		},
		InitialDelaySeconds: 100,
		TimeoutSeconds:      5,
		PeriodSeconds:       30,
		SuccessThreshold:    1,
		FailureThreshold:    3,
	},

	VolumeMounts: []corev1.VolumeMount{
		{
			Name:      Log4jsVolumeName,
			MountPath: "/etc/config",
		},
		{
			Name:      ClusterCaVolumeName,
			MountPath: "/opt/ibm/platform-header/certs",
		},
	},

	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: "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",
				},
			},
		},
	},
}
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/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'";`,
}
View Source
var CrTemplates = `` /* 10771-byte string literal not displayed */

nolint

View Source
var DeamonSetAnnotations = map[string]string{
	"scheduler.alpha.kubernetes.io/critical-pod": "",
	"productName":    "IBM Cloud Platform Common Services",
	"productID":      "068a62892a1e4db39641342e592daa25",
	"productVersion": "3.3.0",
	"productMetric":  "FREE",
}
View Source
var DefaultStatusForCR = []string{"none"}
View Source
var FalseVar = false
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 Replica1 int32 = 1
View Source
var Seconds60 int64 = 60
View Source
var TrueVar = true

Functions

func APIIngressForCommonWebUI

func APIIngressForCommonWebUI(instance *operatorsv1alpha1.CommonWebUI) *netv1.Ingress

func CallbackIngressForCommonWebUI

func CallbackIngressForCommonWebUI(instance *operatorsv1alpha1.CommonWebUI) *netv1.Ingress

func CommonConfigMapUI

func CommonConfigMapUI(instance *operatorsv1alpha1.LegacyHeader) *corev1.ConfigMap

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 IngressForLegacyUI

func IngressForLegacyUI(instance *operatorsv1alpha1.LegacyHeader) *netv1.Ingress

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 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 ReconcileDaemonSet

func ReconcileDaemonSet(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 ReconcileIngress

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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