Skip to content

Commit 24dc7b7

Browse files
committed
Continue standardizing the k8s labels
1 parent 4e60123 commit 24dc7b7

File tree

9 files changed

+23
-41
lines changed

9 files changed

+23
-41
lines changed

kubernetes/internal/weblogic-domain-traefik-security-template.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ metadata:
66
labels:
77
weblogic.domainUID: %DOMAIN_UID%
88
weblogic.domainName: %DOMAIN_NAME%
9-
weblogic.clusterName: %CLUSTER_NAME_LC%
10-
weblogic.clusterNameLC: %CLUSTER_NAME_LC%
9+
weblogic.clusterName: %CLUSTER_NAME%
1110
rules:
1211
- apiGroups:
1312
- ""
@@ -36,8 +35,7 @@ metadata:
3635
labels:
3736
weblogic.domainUID: %DOMAIN_UID%
3837
weblogic.domainName: %DOMAIN_NAME%
39-
weblogic.clusterName: %CLUSTER_NAME_LC%
40-
weblogic.clusterNameLC: %CLUSTER_NAME_LC%
38+
weblogic.clusterName: %CLUSTER_NAME%
4139
roleRef:
4240
apiGroup: rbac.authorization.k8s.io
4341
kind: ClusterRole

kubernetes/internal/weblogic-domain-traefik-template.yaml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ metadata:
77
labels:
88
weblogic.domainUID: %DOMAIN_UID%
99
weblogic.domainName: %DOMAIN_NAME%
10-
weblogic.clusterName: %CLUSTER_NAME_LC%
11-
weblogic.clusterNameLC: %CLUSTER_NAME_LC%
10+
weblogic.clusterName: %CLUSTER_NAME%
1211
---
1312
kind: Deployment
1413
apiVersion: extensions/v1beta1
@@ -18,8 +17,7 @@ metadata:
1817
labels:
1918
weblogic.domainUID: %DOMAIN_UID%
2019
weblogic.domainName: %DOMAIN_NAME%
21-
weblogic.clusterName: %CLUSTER_NAME_LC%
22-
weblogic.clusterNameLC: %CLUSTER_NAME_LC%
20+
weblogic.clusterName: %CLUSTER_NAME%
2321
app: %DOMAIN_UID%-%CLUSTER_NAME_LC%-traefik
2422
spec:
2523
replicas: 1
@@ -31,8 +29,7 @@ spec:
3129
labels:
3230
weblogic.domainUID: %DOMAIN_UID%
3331
weblogic.domainName: %DOMAIN_NAME%
34-
weblogic.clusterName: %CLUSTER_NAME_LC%
35-
weblogic.clusterNameLC: %CLUSTER_NAME_LC%
32+
weblogic.clusterName: %CLUSTER_NAME%
3633
app: %DOMAIN_UID%-%CLUSTER_NAME_LC%-traefik
3734
spec:
3835
serviceAccountName: %DOMAIN_UID%-%CLUSTER_NAME_LC%-traefik
@@ -88,8 +85,7 @@ metadata:
8885
labels:
8986
weblogic.domainUID: %DOMAIN_UID%
9087
weblogic.domainName: %DOMAIN_NAME%
91-
weblogic.clusterName: %CLUSTER_NAME_LC%
92-
weblogic.clusterNameLC: %CLUSTER_NAME_LC%
88+
weblogic.clusterName: %CLUSTER_NAME%
9389
app: %DOMAIN_UID%-%CLUSTER_NAME_LC%-traefik
9490
data:
9591
traefik.toml: |
@@ -113,8 +109,7 @@ metadata:
113109
labels:
114110
weblogic.domainUID: %DOMAIN_UID%
115111
weblogic.domainName: %DOMAIN_NAME%
116-
weblogic.clusterName: %CLUSTER_NAME_LC%
117-
weblogic.clusterNameLC: %CLUSTER_NAME_LC%
112+
weblogic.clusterName: %CLUSTER_NAME%
118113
spec:
119114
selector:
120115
app: %DOMAIN_UID%-%CLUSTER_NAME_LC%-traefik
@@ -133,8 +128,7 @@ metadata:
133128
labels:
134129
weblogic.domainUID: %DOMAIN_UID%
135130
weblogic.domainName: %DOMAIN_NAME%
136-
weblogic.clusterName: %CLUSTER_NAME_LC%
137-
weblogic.clusterNameLC: %CLUSTER_NAME_LC%
131+
weblogic.clusterName: %CLUSTER_NAME%
138132
app: %DOMAIN_UID%-%CLUSTER_NAME_LC%-traefik
139133
spec:
140134
selector:

site/architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ This diagram shows the following details:
3838
* If requested when configuring the domain, a second `NodePort` type service is created for the Administration Server pod. This second service is used to expose a WebLogic channel for the T3 protocol. This service provides T3 access to the Administration Server to clients that are outside the Kubernetes cluster. This service is intended to be used for WLST connections to the Administration Server. This service is labeled with `weblogic.domainUID` and `weblogic.domainName`.
3939
* A pod is created for each WebLogic Managed Server. These pods are labeled with `weblogic.domainUID`, `weblogic.serverName` and `weblogic.domainName`. One container runs in each pod. WebLogic Node Manager and Managed Server processes are run inside each of these containers. The Node Manager process is used as an internal implementation detail for the liveness probe. It is not intended to be used for other purposes, and it may be removed in some future release.
4040
* A `NodePort` type service is created for each Managed Server pod that contains a Managed Server that is not part of a WebLogic cluster. These services provide HTTP access to the Managed Servers to clients that are outside the Kubernetes cluster. These services are intended to be used to access applications running on the Managed Servers. These services are labeled with `weblogic.domainUID` and `weblogic.domainName`.
41-
* An Ingress is created for each WebLogic cluster. This Ingress provides load balanced HTTP access to all Managed Servers in that WebLogic cluster. The operator updates the Ingress every time a Managed Server in the WebLogic cluster becomes “ready” or ceases to be able to service requests, such that the Ingress always points to just those Managed Servers that are able to handle user requests. The Ingress is labeled with `weblogic.domainUID`, `weblogic.clusterNameLC`, `weblogic.clusterName`, and `weblogic.domainName`. The Ingress is also annotated with a class which is used to match Ingresses to the correct instances of the load balancer. In the technology preview release, there is one instance of the load balancer running for each WebLogic cluster, and the load balancers are configured with the root URL path (“/”). More flexible load balancer configuration is planned for a future release.
41+
* An Ingress is created for each WebLogic cluster. This Ingress provides load balanced HTTP access to all Managed Servers in that WebLogic cluster. The operator updates the Ingress every time a Managed Server in the WebLogic cluster becomes “ready” or ceases to be able to service requests, such that the Ingress always points to just those Managed Servers that are able to handle user requests. The Ingress is labeled with `weblogic.domainUID`, `weblogic.clusterName`, and `weblogic.domainName`. The Ingress is also annotated with a class which is used to match Ingresses to the correct instances of the load balancer. In the technology preview release, there is one instance of the load balancer running for each WebLogic cluster, and the load balancers are configured with the root URL path (“/”). More flexible load balancer configuration is planned for a future release.
4242
* If the ELK integration was requested when configuring the operator, there will also be another pod that runs logstash in a container. This pod will publish the logs from all WebLogic Server instances in the domain into ElasticSearch. There is one logstash per domain, but only one ElasticSearch and one Kibana for the entire Kubernetes cluster.
4343

4444
The diagram below shows the components inside the containers running WebLogic Server instances:

src/main/java/oracle/kubernetes/operator/LabelConstants.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ public interface LabelConstants {
1010
public static final String SERVERNAME_LABEL = "weblogic.serverName";
1111
public static final String CHANNELNAME_LABEL = "weblogic.channelName";
1212
public static final String CLUSTERNAME_LABEL = "weblogic.clusterName";
13-
public static final String CLUSTERNAMELC_LABEL = "weblogic.clusterNameLC";
1413
public static final String CREATEDBYOPERATOR_LABEL = "weblogic.createdByOperator";
1514
public static final String OPERATORNAME_LABEL = "weblogic.operatorName";
1615
public static final String APP_LABEL = "app";

src/main/java/oracle/kubernetes/operator/helpers/ConfigMapHelper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ public NextAction onSuccess(Packet packet, V1ConfigMap result, int statusCode,
117117
protected V1ConfigMap computeDomainConfigMap() {
118118
String name = KubernetesConstants.DOMAIN_CONFIG_MAP_NAME;
119119
V1ConfigMap cm = new V1ConfigMap();
120-
120+
cm.setApiVersion("v1");
121+
cm.setKind("ConfigMap");
122+
121123
V1ObjectMeta metadata = new V1ObjectMeta();
122124
metadata.setName(name);
123125
metadata.setNamespace(namespace);

src/main/java/oracle/kubernetes/operator/helpers/PodHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,9 +614,9 @@ protected V1Pod computeManagedPodConfig(TuningParameters configMapHelper, Packet
614614
labels.put(LabelConstants.DOMAINNAME_LABEL, weblogicDomainName);
615615
labels.put(LabelConstants.SERVERNAME_LABEL, weblogicServerName);
616616
labels.put(LabelConstants.CREATEDBYOPERATOR_LABEL, "true");
617-
if (weblogicClusterName != null)
617+
if (weblogicClusterName != null) {
618618
labels.put(LabelConstants.CLUSTERNAME_LABEL, weblogicClusterName);
619-
labels.put(LabelConstants.CLUSTERNAMELC_LABEL, weblogicClusterName.toLowerCase());
619+
}
620620
metadata.setLabels(labels);
621621

622622
V1PodSpec podSpec = new V1PodSpec();

src/test/java/oracle/kubernetes/operator/create/ConfigMapHelperConfigTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ public void computedDomainConfigMap_isCorrect() throws Exception {
4343
private V1ConfigMap getDesiredDomainConfigMap() {
4444
return
4545
newConfigMap()
46-
.apiVersion(null) // TBD - v.s. v1 - should we change it?
47-
.kind(null) // TBD - v.s. ConfigMap - should we change it?
4846
.metadata(newObjectMeta()
4947
.name(DOMAIN_CONFIG_MAP_NAME)
5048
.namespace(NAMESPACE)

src/test/java/oracle/kubernetes/operator/create/CreateDomainGeneratedFilesBaseTest.java

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,7 @@ protected V1ServiceAccount getExpectedTraefikServiceAccount() {
415415
.namespace(getInputs().getNamespace())
416416
.putLabelsItem(DOMAINUID_LABEL, getInputs().getDomainUID())
417417
.putLabelsItem(DOMAINNAME_LABEL, getInputs().getDomainName())
418-
.putLabelsItem(CLUSTERNAME_LABEL, getClusterNameLC())
419-
.putLabelsItem(CLUSTERNAMELC_LABEL, getClusterNameLC()));
418+
.putLabelsItem(CLUSTERNAME_LABEL, getInputs().getClusterName()));
420419
}
421420

422421
@Test
@@ -439,8 +438,7 @@ protected ExtensionsV1beta1Deployment getExpectedTraefikDeployment() {
439438
.namespace(getInputs().getNamespace())
440439
.putLabelsItem(DOMAINUID_LABEL, getInputs().getDomainUID())
441440
.putLabelsItem(DOMAINNAME_LABEL, getInputs().getDomainName())
442-
.putLabelsItem(CLUSTERNAME_LABEL, getClusterNameLC())
443-
.putLabelsItem(CLUSTERNAMELC_LABEL, getClusterNameLC())
441+
.putLabelsItem(CLUSTERNAME_LABEL, getInputs().getClusterName())
444442
.putLabelsItem(APP_LABEL, getTraefikScope()))
445443
.spec(newDeploymentSpec()
446444
.replicas(1)
@@ -450,8 +448,7 @@ protected ExtensionsV1beta1Deployment getExpectedTraefikDeployment() {
450448
.metadata(newObjectMeta()
451449
.putLabelsItem(DOMAINUID_LABEL, getInputs().getDomainUID())
452450
.putLabelsItem(DOMAINNAME_LABEL, getInputs().getDomainName())
453-
.putLabelsItem(CLUSTERNAME_LABEL, getClusterNameLC())
454-
.putLabelsItem(CLUSTERNAMELC_LABEL, getClusterNameLC())
451+
.putLabelsItem(CLUSTERNAME_LABEL, getInputs().getClusterName())
455452
.putLabelsItem(APP_LABEL, getTraefikScope()))
456453
.spec(newPodSpec()
457454
.serviceAccountName(getTraefikScope())
@@ -527,8 +524,7 @@ protected V1ConfigMap getExpectedTraefikConfigMap() {
527524
.namespace(getInputs().getNamespace())
528525
.putLabelsItem(DOMAINUID_LABEL, getInputs().getDomainUID())
529526
.putLabelsItem(DOMAINNAME_LABEL, getInputs().getDomainName())
530-
.putLabelsItem(CLUSTERNAME_LABEL, getClusterNameLC())
531-
.putLabelsItem(CLUSTERNAMELC_LABEL, getClusterNameLC())
527+
.putLabelsItem(CLUSTERNAME_LABEL, getInputs().getClusterName())
532528
.putLabelsItem(APP_LABEL, getTraefikScope()))
533529
.putDataItem(PROPERTY_TRAEFIK_TOML, "");
534530
}
@@ -558,8 +554,7 @@ protected V1Service getExpectedTraefikService() {
558554
.namespace(getInputs().getNamespace())
559555
.putLabelsItem(DOMAINUID_LABEL, getInputs().getDomainUID())
560556
.putLabelsItem(DOMAINNAME_LABEL, getInputs().getDomainName())
561-
.putLabelsItem(CLUSTERNAME_LABEL, getClusterNameLC())
562-
.putLabelsItem(CLUSTERNAMELC_LABEL, getClusterNameLC()))
557+
.putLabelsItem(CLUSTERNAME_LABEL, getInputs().getClusterName()))
563558
.spec(newServiceSpec()
564559
.type("NodePort")
565560
.putSelectorItem(APP_LABEL, getTraefikScope())
@@ -589,8 +584,7 @@ protected V1Service getExpectedTraefikDashboardService() {
589584
.namespace(getInputs().getNamespace())
590585
.putLabelsItem(DOMAINUID_LABEL, getInputs().getDomainUID())
591586
.putLabelsItem(DOMAINNAME_LABEL, getInputs().getDomainName())
592-
.putLabelsItem(CLUSTERNAME_LABEL, getClusterNameLC())
593-
.putLabelsItem(CLUSTERNAMELC_LABEL, getClusterNameLC())
587+
.putLabelsItem(CLUSTERNAME_LABEL, getInputs().getClusterName())
594588
.putLabelsItem(APP_LABEL, getTraefikScope()))
595589
.spec(newServiceSpec()
596590
.type("NodePort")
@@ -620,8 +614,7 @@ protected V1beta1ClusterRole getExpectedTraefikClusterRole() {
620614
.name(getTraefikScope())
621615
.putLabelsItem(DOMAINUID_LABEL, getInputs().getDomainUID())
622616
.putLabelsItem(DOMAINNAME_LABEL, getInputs().getDomainName())
623-
.putLabelsItem(CLUSTERNAME_LABEL, getClusterNameLC())
624-
.putLabelsItem(CLUSTERNAMELC_LABEL, getClusterNameLC()))
617+
.putLabelsItem(CLUSTERNAME_LABEL, getInputs().getClusterName()))
625618
.addRulesItem(newPolicyRule()
626619
.addApiGroupsItem("")
627620
.resources(asList("pods", "services", "endpoints", "secrets"))
@@ -650,8 +643,7 @@ protected V1beta1ClusterRoleBinding getExpectedTraefikDashboardClusterRoleBindin
650643
.name(getTraefikScope())
651644
.putLabelsItem(DOMAINUID_LABEL, getInputs().getDomainUID())
652645
.putLabelsItem(DOMAINNAME_LABEL, getInputs().getDomainName())
653-
.putLabelsItem(CLUSTERNAME_LABEL, getClusterNameLC())
654-
.putLabelsItem(CLUSTERNAMELC_LABEL, getClusterNameLC()))
646+
.putLabelsItem(CLUSTERNAME_LABEL, getInputs().getClusterName()))
655647
.addSubjectsItem(newSubject()
656648
.kind("ServiceAccount")
657649
.name(getTraefikScope())

src/test/java/oracle/kubernetes/operator/create/PodHelperConfigTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,7 @@ private V1Pod getDesiredManagedServerPodConfigForDefaults(String image, String i
401401
.name(MANAGED_OPTION2_NAME)
402402
.value(MANAGED_OPTION2_VALUE));
403403
pod.getMetadata()
404-
.putLabelsItem(CLUSTERNAME_LABEL, CLUSTER_NAME)
405-
.putLabelsItem(CLUSTERNAMELC_LABEL, CLUSTER_NAME.toLowerCase());
404+
.putLabelsItem(CLUSTERNAME_LABEL, CLUSTER_NAME);
406405
return pod;
407406
}
408407

0 commit comments

Comments
 (0)