-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redesign the operator to use a single namespace
- Loading branch information
Showing
17 changed files
with
137 additions
and
166 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...troller/tanzusync/AppDeleteCondition.java → ...erator/controller/AppDeleteCondition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ntroller/tanzusync/AppReadyCondition.java → ...perator/controller/AppReadyCondition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/main/java/org/moussaud/tanzu/tapoperator/controller/ClusterBaseResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.moussaud.tanzu.tapoperator.controller; | ||
|
||
import io.fabric8.kubernetes.api.model.HasMetadata; | ||
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder; | ||
import io.javaoperatorsdk.operator.api.reconciler.dependent.Deleter; | ||
import io.javaoperatorsdk.operator.processing.dependent.Creator; | ||
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependentResource; | ||
import org.moussaud.tanzu.tapoperator.resource.TapResource; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class ClusterBaseResource<R extends HasMetadata> extends KubernetesDependentResource<R, TapResource> | ||
implements Creator<R, TapResource>, Deleter<TapResource>, TapOperatorManagedResource { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(ClusterBaseResource.class); | ||
private final String component; | ||
|
||
public ClusterBaseResource(Class<R> resourceType, String component) { | ||
super(resourceType); | ||
this.component = component; | ||
} | ||
|
||
@Override | ||
public String name(TapResource primary) { | ||
return component; | ||
} | ||
|
||
|
||
@Override | ||
public String getComponent() { | ||
return component; | ||
} | ||
|
||
private static final String K8S_NAME = "app.kubernetes.io/name"; | ||
private static final String K8S_COMPONENT = "app.kubernetes.io/component"; | ||
private static final String K8S_MANAGED_BY = "app.kubernetes.io/managed-by"; | ||
private static final String K8S_OWNER = "tap-operator"; | ||
|
||
protected ObjectMetaBuilder createMeta(TapResource primary) { | ||
return new ObjectMetaBuilder() | ||
.withName(name(primary)) | ||
.addToLabels(K8S_NAME, component) | ||
.addToLabels(K8S_COMPONENT, component) | ||
.addToLabels(K8S_MANAGED_BY, K8S_OWNER); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 4 additions & 5 deletions
9
...roller/tanzusync/ClusterRoleResource.java → ...ontroller/ClusterRoleResourceCluster.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ator/controller/tanzusync/KnownHosts.java → ...zu/tapoperator/controller/KnownHosts.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...oller/tanzusync/SecretExportResource.java → ...ator/controller/SecretExportResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.