Skip to content

Commit 5de958d

Browse files
committed
Initial version of the 1.1. helm-based operator creation
1 parent 8612a81 commit 5de958d

36 files changed

+907
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright 2018, Oracle Corporation and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
3+
4+
name: weblogic-operator
5+
version: 0.2.0
6+
description: Helm package for creation of the Weblogic operator.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2018 Oracle Corporation and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
3+
4+
{{- define "operator.domainConfigMap" }}
5+
---
6+
apiVersion: v1
7+
kind: ConfigMap
8+
metadata:
9+
labels:
10+
weblogic.createdByOperator: "true"
11+
weblogic.operatorName: {{ .operatorNamespace }}
12+
weblogic.resourceVersion: domain-v1
13+
name: weblogic-domain-cm
14+
namespace: {{ .domainsNamespace }}
15+
data:
16+
{{ (.Files.Glob "scripts/domain/*").AsConfig | indent 2 }}
17+
{{- end }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2018 Oracle Corporation and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
3+
4+
{{- define "operator.domainsNamespaces" }}
5+
{{- $scope := . -}}
6+
{{- $domainsNamespaces := merge (dict) .domainsNamespaces -}}
7+
{{- $len := len $domainsNamespaces -}}
8+
{{- if eq $len 0 -}}
9+
{{- $ignore := set $domainsNamespaces "default" (dict) -}}
10+
{{- end -}}
11+
{{- range $key, $element := $domainsNamespaces -}}
12+
{{- $args := merge (dict) $element $scope -}}
13+
{{- $ignore := set $args "domainsNamespace" $key -}}
14+
{{- include "operator.domainsNamespace" $args -}}
15+
{{- /* include "operator.domainConfigMap" $args currently the GA operator runtime does this */ -}}
16+
{{- include "operator.operatorRoleBinding" $args -}}
17+
{{- end }}
18+
{{- end }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2018 Oracle Corporation and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
3+
4+
{{- define "operator.domainsNamespace" }}
5+
{{- if (and (.createDomainsNamespace) (not (eq .domainsNamespace "default"))) }}
6+
---
7+
apiVersion: v1
8+
kind: Namespace
9+
metadata:
10+
labels:
11+
weblogic.operatorName: {{ .operatorNamespace }}
12+
weblogic.resourceVersion: operator-v1
13+
name: {{ .domainsNamespace }}
14+
{{- end }}
15+
{{- end }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2018 Oracle Corporation and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
3+
4+
{{- define "operator.elasticSearchDeployment" }}
5+
{{- if .elkIntegrationEnabled }}
6+
---
7+
apiVersion: apps/v1beta1
8+
kind: Deployment
9+
metadata:
10+
name: elasticsearch
11+
labels:
12+
app: elasticsearch
13+
spec:
14+
replicas: 1
15+
selector:
16+
matchLabels:
17+
app: elasticsearch
18+
template:
19+
metadata:
20+
labels:
21+
app: elasticsearch
22+
spec:
23+
containers:
24+
- name: elasticsearch
25+
image: elasticsearch:5
26+
ports:
27+
- containerPort: 9200
28+
- containerPort: 9300
29+
{{- end }}
30+
{{- end }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright 2018 Oracle Corporation and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
3+
4+
{{- define "operator.elasticSearchService" }}
5+
{{- if .elkIntegrationEnabled }}
6+
---
7+
kind: Service
8+
apiVersion: v1
9+
metadata:
10+
name: elasticsearch
11+
spec:
12+
ports:
13+
- name: http
14+
protocol: TCP
15+
port: 9200
16+
targetPort: 9200
17+
- name: https
18+
protocol: TCP
19+
port: 9300
20+
targetPort: 9300
21+
selector:
22+
app: elasticsearch
23+
{{- end }}
24+
{{- end }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "kubernetes-cluster.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "kubernetes-cluster.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "kubernetes-cluster.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Copyright 2018 Oracle Corporation and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
3+
4+
{{/*
5+
Verify that an input value of a specific kind has been specified.
6+
*/}}
7+
{{- define "operator.verifyInputKind" -}}
8+
{{- $requiredKind := index . 0 -}}
9+
{{- $scope := index . 1 -}}
10+
{{- $value := index . 1 -}}
11+
{{- $name := index . 2 -}}
12+
{{- if not ( hasKey $scope $name ) -}}
13+
{{- $errorMsg := cat "The" $requiredKind "property" $name "must be specified." -}}
14+
{{- $ignore := required $errorMsg "" -}}
15+
{{- end -}}
16+
{{- $value := index $scope $name -}}
17+
{{- $actualKind := kindOf $value -}}
18+
{{- if not ( eq $requiredKind $actualKind ) -}}
19+
{{- $errorMsg := cat "The" $actualKind "property" $name "must be a" $requiredKind "instead." -}}
20+
{{- $ignore := required $errorMsg "" -}}
21+
{{- end -}}
22+
{{- end -}}
23+
24+
{{/*
25+
Verify that a string input value has been specified
26+
*/}}
27+
{{- define "operator.verifyStringInput" -}}
28+
{{- include "operator.verifyInputKind" ( list "string" ( index . 0 ) ( index . 1 ) ) -}}
29+
{{- end -}}
30+
31+
{{/*
32+
Verify that a boolean input value has been specified
33+
*/}}
34+
{{- define "operator.verifyBooleanInput" -}}
35+
{{- include "operator.verifyInputKind" ( list "bool" ( index . 0 ) ( index . 1 ) ) -}}
36+
{{- end -}}
37+
38+
{{/*
39+
Verify that an integer input value has been specified
40+
*/}}
41+
{{- define "operator.verifyIntegerInput" -}}
42+
{{- include "operator.verifyInputKind" ( list "float64" ( index . 0 ) ( index . 1 ) ) -}}
43+
{{- end -}}
44+
45+
{{/*
46+
Verify that an object input value has been specified
47+
*/}}
48+
{{- define "operator.verifyObjectInput" -}}
49+
{{- include "operator.verifyInputKind" ( list "map" ( index . 0 ) ( index . 1 ) ) -}}
50+
{{- end -}}
51+
52+
{{/*
53+
Verify that an enum string input value has been specified
54+
*/}}
55+
{{- define "operator.verifyEnumInput" -}}
56+
{{- $scope := index . 0 -}}
57+
{{- $name := index . 1 -}}
58+
{{- $legalValues := index . 2 -}}
59+
{{- include "operator.verifyStringInput" ( list $scope $name ) -}}
60+
{{- $value := index $scope $name -}}
61+
{{- if not ( has $value $legalValues ) -}}
62+
{{ $errorMsg := cat "The property" $name "must be one of following values" $legalValues "instead of" $value -}}
63+
{{- $ignore := required $errorMsg "" -}}
64+
{{- end -}}
65+
{{- end -}}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2018 Oracle Corporation and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
3+
4+
{{- define "operator.kibanaDeployment" }}
5+
{{- if .elkIntegrationEnabled }}
6+
---
7+
apiVersion: apps/v1beta1
8+
kind: Deployment
9+
metadata:
10+
name: kibana
11+
labels:
12+
app: kibana
13+
spec:
14+
replicas: 1
15+
selector:
16+
matchLabels:
17+
app: kibana
18+
template:
19+
metadata:
20+
labels:
21+
app: kibana
22+
spec:
23+
containers:
24+
- name: kibana
25+
image: kibana:5
26+
ports:
27+
- containerPort: 5601
28+
{{- end }}
29+
{{- end }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2018 Oracle Corporation and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
3+
4+
{{- define "operator.kibanaService" }}
5+
{{- if .elkIntegrationEnabled }}
6+
---
7+
apiVersion: v1
8+
kind: Service
9+
metadata:
10+
name: kibana
11+
labels:
12+
app: kibana
13+
spec:
14+
type: NodePort
15+
ports:
16+
- port: 5601
17+
selector:
18+
app: kibana
19+
{{- end }}
20+
{{- end }}

0 commit comments

Comments
 (0)