|
| 1 | +--- |
| 2 | +title:"Managing applications" |
| 3 | +description:"" |
| 4 | +group:deployment |
| 5 | +toc:true |
| 6 | +--- |
| 7 | + |
| 8 | +Creating and deploying applications is the first part of the continuous deployment/delivery process. An equally important part is optimizing deployed applications when needed, including editing application definitions, and synchronizing or refreshing them on-demand. |
| 9 | +* Edit applications |
| 10 | + Optimize deployed applications by changing application definitions when needed. |
| 11 | + |
| 12 | +* Synchronize applications |
| 13 | + Sync applications on-demand by manually applying sync options or selecting which resources to sync. |
| 14 | + |
| 15 | +<!---* Delete applications |
| 16 | + Delete unused or legacy applications to avoid clutter and remove unnecessary resources.---> |
| 17 | + |
| 18 | +###Edit application configuration |
| 19 | +Optimize deployed applications by updating General or Advanced configuration settings. |
| 20 | + |
| 21 | +>You cannot change application definitions (the application name and the selected runtime), and the Git Source selected for the application. |
| 22 | +
|
| 23 | +**How to** |
| 24 | + |
| 25 | +1. In the Codefresh UI, go to the[Applications dashboard](https://g.codefresh.io/2.0/applications-dashboard){:target="\_blank"}. |
| 26 | +1. Do one of the following: |
| 27 | +* Select the application to update, and then from the context menu on the right, select**Edit**. |
| 28 | +* Click the application and then select the**Configuration** tab. |
| 29 | + |
| 30 | +{% include |
| 31 | + image.html |
| 32 | + lightbox="true" |
| 33 | + file="/images/applications/edit-app-configuration-tab.png" |
| 34 | + url="/images/applications/edit-app-configuration-tab.png" |
| 35 | + alt="Configuration tab with application settings" |
| 36 | + caption="Configuration tab with application settings" |
| 37 | + max-width="70%" |
| 38 | + %} |
| 39 | + |
| 40 | +{:start="3"} |
| 41 | +1. Update the**General** or**Advanced** configuration settings as needed: |
| 42 | +[General configuration]({{site.baseurl}}docs/deployment/create-application/#application-general-configuration-settings) |
| 43 | +[Advanced configuration]({{site.baseurl}}docs/deployment/create-application/#advanced-configuration-settings) |
| 44 | + When you change a setting, the Commit and Discard Changes buttons are displayed. |
| 45 | + |
| 46 | + {% include |
| 47 | + image.html |
| 48 | + lightbox="true" |
| 49 | + file="/images/applications/edit-app-change-setting.png" |
| 50 | + url="/images/applications/edit-app-change-setting.png" |
| 51 | + alt="Edit application settings" |
| 52 | + caption="Edit application settings" |
| 53 | + max-width="70%" |
| 54 | + %} |
| 55 | + |
| 56 | +{:start="4"} |
| 57 | +1. Do one of the following: |
| 58 | +* To_commit all changes_, click**Commit**. This final commit screen is displayed with a diff view of the changes. |
| 59 | +* To_undo all changes_ and return to the previous settings, click**Discard Changes**. This action removes all the changes you have made so far and returns you to the Applications dashboard. |
| 60 | + |
| 61 | +>If you change settings and then restore existing values for the same, Codefresh automatically removes the Commit and Discard Changes buttons as there are no new changes to commit or discard. |
| 62 | +
|
| 63 | + {% include |
| 64 | + image.html |
| 65 | + lightbox="true" |
| 66 | + file="/images/applications/edit-app-diff-view.png" |
| 67 | + url="/images/applications/edit-app-diff-view.png" |
| 68 | + alt="Commit changes with diff view" |
| 69 | + caption="Commit changes with diff view" |
| 70 | + max-width="70%" |
| 71 | + %} |
| 72 | + |
| 73 | +{:start="5"} |
| 74 | +1. To confirm all changes, at the bottom-left, click**Commit**. |
| 75 | + The changes are committed to Git, and in a few moments also synced to the cluster. |
| 76 | + |
| 77 | +{::nomarkdown} |
| 78 | +<br><br> |
| 79 | +{:/} |
| 80 | + |
| 81 | +###On-demand application sync |
| 82 | +Synchonize applications manually to reconcile the desired state with the live state. |
| 83 | +Instead of waiting for Argo CD to detect differences between the desired and live states and initate the sync if automated sync is enabled, expedite Git-to-cluster sync by selecting the relevant sync options or selecting the specific resources to sync. |
| 84 | +On-demand application sync is useful if you have updated only a few resources. |
| 85 | + |
| 86 | +Manual application sync options are grouped into: |
| 87 | +* Revision settings with branch and Kubernetes apply options |
| 88 | +* Additional settings with sync options as in the General application settings |
| 89 | +* Synchonize Resource settings to selectively sync resources |
| 90 | + |
| 91 | +>The sync options selected for manual sync override the sync options defined for the application. |
| 92 | +
|
| 93 | +For how-to instructions, see[Manually synchronize an application](#manually-synchronize-an-application). |
| 94 | + |
| 95 | +{::nomarkdown} |
| 96 | +<br> |
| 97 | +{:/} |
| 98 | + |
| 99 | +####Revision settings for application sync |
| 100 | +Revision settings determine the behavior for the branch you select. |
| 101 | + |
| 102 | +**Revision** |
| 103 | +The branch in Git to synchronize with the cluster. |
| 104 | + |
| 105 | +**Prune** |
| 106 | +When selected, removes legacy resources from the cluster that do not exist currently in the Git branch. |
| 107 | + |
| 108 | +**Apply only** |
| 109 | +When selected, uses the Kubernetes apply command (`kubectl apply`) to update the existing configuration with_only_ the changes. |
| 110 | +For more information, see[In-place updates of resources](https://kubernetes.io/docs/concepts/cluster-administration/manage-deployment/#in-place-updates-of-resources), or read this[blog](https://www.containiq.com/post/kubectl-apply-vs-create). |
| 111 | + |
| 112 | +**Dry run** |
| 113 | +When selected, allows you to preview the application before changes are made to the cluster. |
| 114 | + |
| 115 | +**Force** |
| 116 | +When selected, orphans the dependents of a deleted resource during the sync operation. This option is useful to prevent accumulation of unused resources in deployed applications. |
| 117 | + |
| 118 | +{::nomarkdown} |
| 119 | +<br> |
| 120 | +{:/} |
| 121 | + |
| 122 | +####Additional Options for application sync |
| 123 | + |
| 124 | +{::nomarkdown} |
| 125 | +<br> |
| 126 | +{:/} |
| 127 | + |
| 128 | +#####Sync Options |
| 129 | + |
| 130 | +***Skip schema validation** |
| 131 | + When selected, bypasses validating the YAML schema. |
| 132 | +***Auto-create namespace** |
| 133 | + When selected, automatically creates the namespace if the specified namespace does not exist in the cluster. If the namespace already exists, this setting is ignored. |
| 134 | +***Prune last** |
| 135 | + When selected, removes those resources that do not exist in the currently deployed version during the final wave of the sync operation. See[Prune last](https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#prune-last){:target="\_blank"}. |
| 136 | +***Apply out of sync only** |
| 137 | + When selected, syncs only those resources in the application that have been changed and are`OutOfSync`, instead of syncing every resource regardless of their state. This option is useful to reduce load and save time when you have thousands of resources in an application. See <ahref="" >[Selective Sync](https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#selective-sync){:target="\_blank"}. |
| 138 | +>Selecting this option overrides specific resources selected in`Synchronize Resource` options. |
| 139 | +***Respect ignore differences** |
| 140 | + When selected, Argo CD omits resources defined for the`spec.ignoreDifferences` attribute from the sync. Otherwise, Argo CD implements the desired state ad-hoc during the sync operation. See[Respect ignore difference configs](https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#respect-ignore-difference-configs){:target="\_blank"}. |
| 141 | + |
| 142 | +{::nomarkdown} |
| 143 | +<br> |
| 144 | +{:/} |
| 145 | + |
| 146 | +#####Prune propagation policy |
| 147 | +{::nomarkdown}Defines how resources are pruned, applying Kubernetes cascading deletion prune policies. |
| 148 | +Read more at <ahref="https://kubernetes.io/docs/concepts/architecture/garbage-collection/#cascading-deletion"target="_blank">Kubernetes - Cascading deletion</a>.<ul><li><b>Foreground</b>: The default prune propagation policy used by Argo CD. With this policy, Kubernetes changes the state of the owner resource to`deletion in progress`, until the controller deletes the dependent resources and finally the owner resource itself. </li><li><b>Background</b>: When selected, Kubernetes deletes the owner resource immediately, and then deletes the dependent resources in the background.</li><li><b>Orphan</b>: When selected, Kubernetes deletes the dependent resources that remain orphaned after the owner resource is deleted.</li></ul> </br>{:/} |
| 149 | +All Prune propagation policies can be used with: |
| 150 | + |
| 151 | +**Replace**: When selected, Argo CD executes`kubectl replace` or`kubectl create`, instead of the default`kubectl apply` to enforce the changes in Git. This action will potentially recreate resources and should be used with care. See[Replace Resource Instead Of Applying Change](https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#replace-resource-instead-of-applying-changes){:target="\_blank"}. |
| 152 | + |
| 153 | + |
| 154 | +**Retry**: When selected, retries a failed sync operation, based on the retry settings configured: |
| 155 | +* Maximum number of sync retries (**Limit**) |
| 156 | +* Duration of each retry attempt in seconds, minutes, or hours (**Duration**) |
| 157 | +* Maximum duration permitted for each retry (**Max Duration**) |
| 158 | +* Factor by which to multiply the Duration in the event of a failed retry (**Factor**). A factor of 2 for example, attempts the second retry in 2 X 2 seconds, where 2 seconds is the Duration. |
| 159 | + |
| 160 | +{::nomarkdown} |
| 161 | +<br> |
| 162 | +{:/} |
| 163 | + |
| 164 | +####Selective resource synchronization for application sync |
| 165 | +Synchonize Resource options allow you to selectively sync application resources. You can bypass sync settings at the application level, and directly select the resources you want to sync, by state or otherwise. |
| 166 | +* All resources regardless of their sync states |
| 167 | +* Only out-of-sync resources |
| 168 | +* Only selected resources |
| 169 | + |
| 170 | +>Selecting`Apply out of sync only` in Additional options, ignores specifc resources selected here. |
| 171 | +
|
| 172 | +By default, Synchronize Resources displays and selects all resources in the application. |
| 173 | + |
| 174 | + {% include |
| 175 | + image.html |
| 176 | + lightbox="true" |
| 177 | + file="/images/applications/sync-manual-resources-form.png" |
| 178 | + url="/images/applications/sync-manual-resources-form.png" |
| 179 | + alt="Default settings for Synchronize Resources" |
| 180 | + caption="Default settings for Synchronize Resources" |
| 181 | + max-width="50%" |
| 182 | + %} |
| 183 | + |
| 184 | +You can search/filter resources using part of the resource names or regex strings, and then select the resources you want to sync. |
| 185 | +For example, if you made changes to`api` resources or`audit` resources, type`api` or`audit` to locate the resources and then selectively sync those resources. |
| 186 | + |
| 187 | + {% include |
| 188 | + image.html |
| 189 | + lightbox="true" |
| 190 | + file="/images/applications/sync-manual-resource-search.png" |
| 191 | + url="/images/applications/sync-manual-resource-search.png" |
| 192 | + alt="Selective sync in Synchronize Resources" |
| 193 | + caption="Selective sync in Synchronize Resources" |
| 194 | + max-width="50%" |
| 195 | + %} |
| 196 | + |
| 197 | +{::nomarkdown} |
| 198 | +<br><br> |
| 199 | +{:/} |
| 200 | + |
| 201 | +####Manually synchronize an application |
| 202 | +Perform on-demand app sync when needed. |
| 203 | + |
| 204 | +**Before you begin** |
| 205 | + |
| 206 | +Review: |
| 207 | +*[Revision settings for application sync](#revision-settings-for-application-sync) |
| 208 | +*[Additional options for application sync](#additional-options-for-application-sync) |
| 209 | +*[Selective resource synchronization for application sync](#selective-resource-synchronization-for-application-sync) |
| 210 | + |
| 211 | +**How to** |
| 212 | +1. In the Codefresh UI, go to the[Applications dashboard](https://g.codefresh.io/2.0/applications-dashboard){:target="\_blank"}. |
| 213 | +1. Select the application to sync, and do one of the following: |
| 214 | +* From the application's context menu on the right, select**Synchronize**. |
| 215 | +* On the top-right, click**Synchronize**. |
| 216 | +1. Select the**Revision** and**Additional Options** for the manual sync. |
| 217 | +1. Click**Next**. |
| 218 | +1. In**Synchronize Resources**, select the scope of the manual sync: |
| 219 | +* To sync only specific resources, search for the resources by any part of their names, or define a Regex to filter by the required resources. |
| 220 | +***All**: Sync all resources regardless of their sync state. |
| 221 | +***Out of sync**: Sync_only_ resources that are`Out of sync`. |
| 222 | +>If you have already selected**Apply out of sync only** in Additional Options, this option is ignored. |
| 223 | +***None**: Deselect all resources. |
| 224 | + |
| 225 | +{::nomarkdown} |
| 226 | +<br><br> |
| 227 | +{:/} |
| 228 | + |
| 229 | +###Sync with Refresh/hard refresh |
| 230 | +You can sync applications also using the Refresh and Hard Refresh options. |
| 231 | +Argo CD maintains a cache of the application manifests in the Git repository. Both actions result in Argo CD syncing the application, the only difference being in the state of the cached manifests. |
| 232 | + |
| 233 | +* Refresh: Compares the desired state in Git to the live state on the cluster, and syncs the desired state with the live state on detecting changes. Manifest cache is left unchanged. |
| 234 | +* Hard Refresh: Also compares the desired state to the live state on the cluster, and syncs the desired state with the live state on detecting changes, and also replaces the manifest cache. |
| 235 | + |
| 236 | +>We recommend using the sync strategies to sync applications. |
| 237 | +
|
| 238 | +1. In the Codefresh UI, go to the[Applications dashboard](https://g.codefresh.io/2.0/applications-dashboard){:target="\_blank"}. |
| 239 | +1. Drill down into the application, and from the top-right, select**Refresh**, or click the context menu and then select**Hard Refresh**. |
| 240 | + |
| 241 | + {% include |
| 242 | + image.html |
| 243 | + lightbox="true" |
| 244 | + file="/images/applications/app-refresh-hard-refresh.png" |
| 245 | + url="/images/applications/app-refresh-hard-refresh.png" |
| 246 | + alt="Application sync with Refresh/Hard Refresh" |
| 247 | + caption="Application sync with Refresh/Hard Refresh" |
| 248 | + max-width="60%" |
| 249 | + %} |
| 250 | + |
| 251 | + |
| 252 | +<!---### Delete an application |
| 253 | +Delete an application from Codefresh. Deleting an application deletes the manifests from the Git repository, and then from the cluster where it is deployed. When deleted from the cluster, the application is removed from the Applications dashboard in Codefresh. |
| 254 | +
|
| 255 | +>The scope of the delete action is determined by the **Prune resources** option in the application's General settings. |
| 256 | +When selected, both the application and its resources are deleted. When cleared, only the application is deleted. For more information, review [Sync settings]({{site.baseurl}}/docs/deployment/create-application/#sync-settings). |
| 257 | +Codefresh warns you of the implication of deleting the selected application in the Delete form. |
| 258 | +
|
| 259 | +1. In the Codefresh UI, go to the [Applications dashboard](https://g.codefresh.io/2.0/applications-dashboard){:target="\_blank"}. |
| 260 | +1. Select the application to delete. |
| 261 | +1. From the application's context menu on the right, select **Delete**. |
| 262 | +
|
| 263 | + {% include |
| 264 | + image.html |
| 265 | + lightbox="true" |
| 266 | + file="/images/applications/app-delete-option.png" |
| 267 | + url="/images/applications/app-delete-option.png" |
| 268 | + alt="Delete application" |
| 269 | + caption="Delete application" |
| 270 | + max-width="80%" |
| 271 | + %} |
| 272 | +
|
| 273 | + Pay attention to the _impact of the delete action_ for the selected application that Codefresh displays. |
| 274 | +
|
| 275 | + {% include |
| 276 | + image.html |
| 277 | + lightbox="true" |
| 278 | + file="/images/applications/delete-app-prune-affects.png" |
| 279 | + url="/images/applications/delete-app-prune-affects.png" |
| 280 | + alt="Prune setting impact on deleting application" |
| 281 | + caption="Prune setting impact on deleting application" |
| 282 | + max-width="70%" |
| 283 | + %} |
| 284 | +
|
| 285 | +{:start="4"} |
| 286 | +1. To confirm, click **Commit & Delete**. ---> |
| 287 | + |
| 288 | +###Related information |
| 289 | +[Creating applications]({{site.baseurl}}/docs/deployment/create-application/) |
| 290 | +[Applications dashboard]({{site.baseurl}}/docs/deployment/applications-dashboard/) |
| 291 | +[Images in Codefresh]({{site.baseurl}}/docs/deployment/images/) |