public class ApplyService extends Object
Constructor and Description |
---|
ApplyService(io.fabric8.kubernetes.client.KubernetesClient kubernetesClient,
io.fabric8.maven.docker.util.Logger log) |
Modifier and Type | Method and Description |
---|---|
void |
apply(Object dto,
String sourceName)
Applies the given DTOs onto the Kubernetes master
|
void |
applyBuildConfig(io.fabric8.openshift.api.model.BuildConfig entity,
String sourceName) |
void |
applyCustomResource(File customResourceFile,
String namespace,
io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext context) |
void |
applyCustomResourceDefinition(io.fabric8.kubernetes.api.model.apiextensions.CustomResourceDefinition entity,
String sourceName) |
void |
applyImageStream(io.fabric8.openshift.api.model.ImageStream entity,
String sourceName) |
protected void |
applyJob(io.fabric8.kubernetes.api.model.batch.Job job,
String sourceName) |
void |
applyList(io.fabric8.kubernetes.api.model.KubernetesList list,
String sourceName) |
boolean |
applyNamespace(io.fabric8.kubernetes.api.model.Namespace entity)
Returns true if the namespace is created
|
void |
applyNamespace(String namespaceName) |
void |
applyNamespace(String namespaceName,
Map<String,String> labels) |
void |
applyOAuthClient(io.fabric8.openshift.api.model.OAuthClient entity,
String sourceName) |
void |
applyPersistentVolumeClaim(io.fabric8.kubernetes.api.model.PersistentVolumeClaim entity,
String sourceName) |
void |
applyPod(io.fabric8.kubernetes.api.model.Pod pod,
String sourceName) |
boolean |
applyProject(io.fabric8.openshift.api.model.Project project)
Creates and return a project in openshift
|
boolean |
applyProjectRequest(io.fabric8.openshift.api.model.ProjectRequest entity)
Returns true if the ProjectRequest is created
|
void |
applyReplicationController(io.fabric8.kubernetes.api.model.ReplicationController replicationController,
String sourceName) |
<T extends io.fabric8.kubernetes.api.model.HasMetadata,L,D> |
applyResource(T resource,
String sourceName,
io.fabric8.kubernetes.client.dsl.MixedOperation<T,L,D,? extends io.fabric8.kubernetes.client.dsl.Resource<T,D>> resources) |
void |
applyRoleBinding(io.fabric8.kubernetes.api.model.rbac.RoleBinding entity,
String sourceName) |
void |
applyRoute(io.fabric8.openshift.api.model.Route entity,
String sourceName) |
void |
applySecret(io.fabric8.kubernetes.api.model.Secret secret,
String sourceName) |
void |
applyService(io.fabric8.kubernetes.api.model.Service service,
String sourceName) |
void |
applyServiceAccount(io.fabric8.kubernetes.api.model.ServiceAccount serviceAccount,
String sourceName)
Creates/updates a service account and processes it returning the processed DTOs
|
Object |
applyTemplate(io.fabric8.openshift.api.model.Template entity,
String sourceName)
Creates/updates the template and processes it returning the processed DTOs
|
boolean |
checkNamespace(String namespaceName) |
protected void |
copyAllImageStreamTags(io.fabric8.openshift.api.model.ImageStream from,
io.fabric8.openshift.api.model.ImageStream to) |
void |
deleteCustomResource(File customResourceFile,
String namespace,
io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext crdContext) |
boolean |
deleteNamespace(String namespaceName) |
void |
doCreateBuildConfig(io.fabric8.openshift.api.model.BuildConfig entity,
String namespace,
String sourceName) |
void |
doCreateJob(io.fabric8.kubernetes.api.model.batch.Job job,
String namespace,
String sourceName) |
protected void |
doCreateOAuthClient(io.fabric8.openshift.api.model.OAuthClient entity,
String sourceName) |
protected void |
doCreatePersistentVolumeClaim(io.fabric8.kubernetes.api.model.PersistentVolumeClaim entity,
String namespace,
String sourceName) |
protected void |
doCreatePod(io.fabric8.kubernetes.api.model.Pod pod,
String namespace,
String sourceName) |
protected void |
doCreateReplicationController(io.fabric8.kubernetes.api.model.ReplicationController replicationController,
String namespace,
String sourceName) |
protected <T extends io.fabric8.kubernetes.api.model.HasMetadata,L,D> |
doCreateResource(T resource,
String namespace,
String sourceName,
io.fabric8.kubernetes.client.dsl.MixedOperation<T,L,D,? extends io.fabric8.kubernetes.client.dsl.Resource<T,D>> resources) |
void |
doCreateRoleBinding(io.fabric8.kubernetes.api.model.rbac.RoleBinding entity,
String namespace,
String sourceName) |
protected void |
doCreateSecret(io.fabric8.kubernetes.api.model.Secret secret,
String namespace,
String sourceName) |
protected void |
doCreateService(io.fabric8.kubernetes.api.model.Service service,
String namespace,
String sourceName) |
protected void |
doCreateServiceAccount(io.fabric8.kubernetes.api.model.ServiceAccount serviceAccount,
String namespace,
String sourceName) |
protected void |
doCreateTemplate(io.fabric8.openshift.api.model.Template entity,
String namespace,
String sourceName) |
File |
getBasedir() |
protected String |
getNamespace(io.fabric8.kubernetes.api.model.HasMetadata entity)
Returns the namespace defined in the entity or the configured namespace
|
io.fabric8.openshift.client.OpenShiftClient |
getOpenShiftClient() |
void |
installTemplate(io.fabric8.openshift.api.model.Template entity,
String sourceName)
Installs the template into the namespace without processing it
|
boolean |
isAllowCreate()
Returns true if this controller allows new resources to be created in the given namespace
|
protected boolean |
isBound(io.fabric8.kubernetes.api.model.PersistentVolumeClaim claim) |
boolean |
isIgnoreBoundPersistentVolumeClaims()
If enabled, persistent volume claims are not replaced (deleted and recreated) if already bound
|
boolean |
isIgnoreRunningOAuthClients() |
boolean |
isIgnoreServiceMode()
If enabled then all services are ignored to avoid them being recreated.
|
boolean |
isProcessTemplatesLocally() |
boolean |
isRecreateMode()
If enabled then updates are performed by deleting the resource first then creating it
|
protected boolean |
isRunning(io.fabric8.kubernetes.api.model.HasMetadata entity) |
boolean |
isServicesOnlyMode()
If enabled then only services are created/updated to allow services to be created/updated across
a number of apps before any pods/replication controllers are updated
|
protected void |
logGeneratedEntity(String message,
String namespace,
io.fabric8.kubernetes.api.model.HasMetadata entity,
Object result) |
protected void |
onApplyError(String message,
Exception e)
Logs an error applying some JSON to Kubernetes and optionally throws an exception
|
Object |
processTemplate(io.fabric8.openshift.api.model.Template entity,
String sourceName) |
void |
setAllowCreate(boolean allowCreate) |
void |
setBasedir(File basedir) |
void |
setDeletePodsOnReplicationControllerUpdate(boolean deletePodsOnReplicationControllerUpdate) |
void |
setIgnoreBoundPersistentVolumeClaims(boolean ignoreBoundPersistentVolumeClaims)
Do not replace (delete and recreate) persistent volume claims if already bound
|
void |
setIgnoreRunningOAuthClients(boolean ignoreRunningOAuthClients) |
void |
setIgnoreServiceMode(boolean ignoreServiceMode) |
void |
setLogJsonDir(File logJsonDir)
Lets you configure the directory where JSON logging files should go
|
void |
setNamespace(String namespace) |
void |
setProcessTemplatesLocally(boolean processTemplatesLocally) |
void |
setRollingUpgrade(boolean rollingUpgrade) |
void |
setRollingUpgradePreserveScale(boolean rollingUpgradePreserveScale) |
void |
setServicesOnlyMode(boolean servicesOnlyMode) |
void |
setSupportOAuthClients(boolean supportOAuthClients) |
public ApplyService(io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, io.fabric8.maven.docker.util.Logger log)
public void apply(Object dto, String sourceName) throws Exception
Exception
public void applyOAuthClient(io.fabric8.openshift.api.model.OAuthClient entity, String sourceName)
protected void doCreateOAuthClient(io.fabric8.openshift.api.model.OAuthClient entity, String sourceName)
public Object applyTemplate(io.fabric8.openshift.api.model.Template entity, String sourceName) throws Exception
Exception
public void installTemplate(io.fabric8.openshift.api.model.Template entity, String sourceName)
public io.fabric8.openshift.client.OpenShiftClient getOpenShiftClient()
protected void doCreateTemplate(io.fabric8.openshift.api.model.Template entity, String namespace, String sourceName)
public void applyServiceAccount(io.fabric8.kubernetes.api.model.ServiceAccount serviceAccount, String sourceName) throws Exception
Exception
protected void doCreateServiceAccount(io.fabric8.kubernetes.api.model.ServiceAccount serviceAccount, String namespace, String sourceName)
public void applyPersistentVolumeClaim(io.fabric8.kubernetes.api.model.PersistentVolumeClaim entity, String sourceName) throws Exception
Exception
public void applyCustomResourceDefinition(io.fabric8.kubernetes.api.model.apiextensions.CustomResourceDefinition entity, String sourceName)
public void applyCustomResource(File customResourceFile, String namespace, io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext context) throws Exception
Exception
public void deleteCustomResource(File customResourceFile, String namespace, io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext crdContext) throws Exception
Exception
protected boolean isBound(io.fabric8.kubernetes.api.model.PersistentVolumeClaim claim)
protected void doCreatePersistentVolumeClaim(io.fabric8.kubernetes.api.model.PersistentVolumeClaim entity, String namespace, String sourceName)
public void applySecret(io.fabric8.kubernetes.api.model.Secret secret, String sourceName) throws Exception
Exception
protected void doCreateSecret(io.fabric8.kubernetes.api.model.Secret secret, String namespace, String sourceName)
protected void logGeneratedEntity(String message, String namespace, io.fabric8.kubernetes.api.model.HasMetadata entity, Object result)
public Object processTemplate(io.fabric8.openshift.api.model.Template entity, String sourceName)
public void applyRoute(io.fabric8.openshift.api.model.Route entity, String sourceName)
public void applyBuildConfig(io.fabric8.openshift.api.model.BuildConfig entity, String sourceName)
public void doCreateBuildConfig(io.fabric8.openshift.api.model.BuildConfig entity, String namespace, String sourceName)
public void applyRoleBinding(io.fabric8.kubernetes.api.model.rbac.RoleBinding entity, String sourceName)
public void doCreateRoleBinding(io.fabric8.kubernetes.api.model.rbac.RoleBinding entity, String namespace, String sourceName)
public void applyImageStream(io.fabric8.openshift.api.model.ImageStream entity, String sourceName)
protected void copyAllImageStreamTags(io.fabric8.openshift.api.model.ImageStream from, io.fabric8.openshift.api.model.ImageStream to)
public void applyList(io.fabric8.kubernetes.api.model.KubernetesList list, String sourceName) throws Exception
Exception
public void applyService(io.fabric8.kubernetes.api.model.Service service, String sourceName) throws Exception
Exception
public <T extends io.fabric8.kubernetes.api.model.HasMetadata,L,D> void applyResource(T resource, String sourceName, io.fabric8.kubernetes.client.dsl.MixedOperation<T,L,D,? extends io.fabric8.kubernetes.client.dsl.Resource<T,D>> resources) throws Exception
Exception
protected <T extends io.fabric8.kubernetes.api.model.HasMetadata,L,D> void doCreateResource(T resource, String namespace, String sourceName, io.fabric8.kubernetes.client.dsl.MixedOperation<T,L,D,? extends io.fabric8.kubernetes.client.dsl.Resource<T,D>> resources) throws Exception
Exception
protected void doCreateService(io.fabric8.kubernetes.api.model.Service service, String namespace, String sourceName)
public boolean checkNamespace(String namespaceName)
public boolean deleteNamespace(String namespaceName)
public void applyNamespace(String namespaceName)
public boolean applyNamespace(io.fabric8.kubernetes.api.model.Namespace entity)
public boolean applyProject(io.fabric8.openshift.api.model.Project project)
project
- public boolean applyProjectRequest(io.fabric8.openshift.api.model.ProjectRequest entity)
public void applyReplicationController(io.fabric8.kubernetes.api.model.ReplicationController replicationController, String sourceName) throws Exception
Exception
protected void doCreateReplicationController(io.fabric8.kubernetes.api.model.ReplicationController replicationController, String namespace, String sourceName)
public void applyPod(io.fabric8.kubernetes.api.model.Pod pod, String sourceName) throws Exception
Exception
protected void doCreatePod(io.fabric8.kubernetes.api.model.Pod pod, String namespace, String sourceName)
protected void applyJob(io.fabric8.kubernetes.api.model.batch.Job job, String sourceName)
public void doCreateJob(io.fabric8.kubernetes.api.model.batch.Job job, String namespace, String sourceName) throws io.fabric8.kubernetes.client.KubernetesClientException
io.fabric8.kubernetes.client.KubernetesClientException
protected String getNamespace(io.fabric8.kubernetes.api.model.HasMetadata entity)
public void setNamespace(String namespace)
public boolean isProcessTemplatesLocally()
public void setProcessTemplatesLocally(boolean processTemplatesLocally)
public void setDeletePodsOnReplicationControllerUpdate(boolean deletePodsOnReplicationControllerUpdate)
public void setLogJsonDir(File logJsonDir)
public File getBasedir()
public void setBasedir(File basedir)
protected boolean isRunning(io.fabric8.kubernetes.api.model.HasMetadata entity)
protected void onApplyError(String message, Exception e)
public boolean isAllowCreate()
public void setAllowCreate(boolean allowCreate)
public boolean isRecreateMode()
public void setServicesOnlyMode(boolean servicesOnlyMode)
public boolean isServicesOnlyMode()
public boolean isIgnoreServiceMode()
public void setIgnoreServiceMode(boolean ignoreServiceMode)
public boolean isIgnoreRunningOAuthClients()
public void setIgnoreRunningOAuthClients(boolean ignoreRunningOAuthClients)
public boolean isIgnoreBoundPersistentVolumeClaims()
public void setIgnoreBoundPersistentVolumeClaims(boolean ignoreBoundPersistentVolumeClaims)
public void setSupportOAuthClients(boolean supportOAuthClients)
public void setRollingUpgrade(boolean rollingUpgrade)
public void setRollingUpgradePreserveScale(boolean rollingUpgradePreserveScale)
Copyright © 2021. All rights reserved.