gyfora commented on code in PR #167:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/167#discussion_r849400053


##########
docs/content/docs/operations/upgrade.md:
##########
@@ -0,0 +1,69 @@
+---
+title: "Upgrade"
+weight: 4
+type: docs
+aliases:
+- /operations/upgrade.html
+---
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# Upgrade CustomResourceDefinition
+During development, we delete the old CRD and create it from scratch. In an 
environment with existing deployments that is not possible, as deleting the CRD 
would wipe out all existing CRs.
+The following steps demonstrate the CRD upgrade process from `v1alpha1` to 
`v1beta1` in an environment with an existing 
[stateful](https://github.com/apache/flink-kubernetes-operator/blob/main/examples/basic-checkpoint-ha.yaml)
 job. After the CRD upgrade, the job will resumed from the savedpoint.
+
+1. Suspend the job
+    ```sh
+    kubectl patch flinkdeployment/basic-checkpoint-ha-example --type=merge -p 
'{"spec": {"job": {"state": "suspended"}}}'

Review Comment:
   if we want to guarantee that a savepoint is created we should always change 
the `upgradeMode` of the job to `savepoint` as well



##########
docs/content/docs/operations/upgrade.md:
##########
@@ -0,0 +1,69 @@
+---
+title: "Upgrade"
+weight: 4
+type: docs
+aliases:
+- /operations/upgrade.html
+---
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# Upgrade CustomResourceDefinition
+During development, we delete the old CRD and create it from scratch. In an 
environment with existing deployments that is not possible, as deleting the CRD 
would wipe out all existing CRs.
+The following steps demonstrate the CRD upgrade process from `v1alpha1` to 
`v1beta1` in an environment with an existing 
[stateful](https://github.com/apache/flink-kubernetes-operator/blob/main/examples/basic-checkpoint-ha.yaml)
 job. After the CRD upgrade, the job will resumed from the savedpoint.
+
+1. Suspend the job
+    ```sh
+    kubectl patch flinkdeployment/basic-checkpoint-ha-example --type=merge -p 
'{"spec": {"job": {"state": "suspended"}}}'
+    ```
+    Verify `deploy/basic-checkpoint-ha-example` has terminated and 
`flinkdeployment/basic-checkpoint-ha-example` has the Last Savepoint Location 
similar to 
`file:/flink-data/savepoints/savepoint-000000-aec3dd08e76d/_metadata`. This 
file will used to restore the job.
+
+2. Delete the job:
+   ```sh
+   kubectl delete flinkdeployment/basic-checkpoint-ha-example
+   ```
+
+3. Uninstall flink-kubernetes-operator helm chart and the CRD with the old 
`v1alpha1` version:
+    ```sh
+    helm uninstall flink-kubernetes-operator
+    kubectl delete crd flinkdeployments.flink.apache.org
+    ```
+4. Reinstall the flink-kubernetes-operator helm chart with the `v1beta1` CRD
+    ```sh
+    helm repo update flink-operator-repo
+    helm install flink-kubernetes-operator 
flink-operator-repo/flink-kubernetes-operator
+    ```
+    Verify the `deploy/flink-kubernetes-operator` log has:
+    ```
+    2022-04-13 06:09:40,761 i.j.o.Operator                 [INFO ] Registered 
reconciler: 'flinkdeploymentcontroller' for resource: 'class 
org.apache.flink.kubernetes.operator.crd.FlinkDeployment' for namespace(s): 
[all namespaces]
+    2022-04-13 06:09:40,943 i.f.k.c.i.VersionUsageUtils    [WARN ] The client 
is using resource type 'flinksessionjobs' with unstable version 'v1beta1'
+    2022-04-13 06:09:41,461 i.j.o.Operator                 [INFO ] Registered 
reconciler: 'flinksessionjobcontroller' for resource: 'class 
org.apache.flink.kubernetes.operator.crd.FlinkSessionJob' for namespace(s): 
[all namespaces]
+    2022-04-13 06:09:41,464 i.j.o.Operator                 [INFO ] Operator 
SDK 2.1.2 (commit: a3a81ef) built on 2022-03-15T09:59:42.000+0000 starting...
+    2022-04-13 06:09:41,464 i.j.o.Operator                 [INFO ] Client 
version: 5.12.1
+    2022-04-13 06:09:41,499 i.f.k.c.i.VersionUsageUtils    [WARN ] The client 
is using resource type 'flinkdeployments' with unstable version 'v1beta1'
+    ```
+5. Restore the job from the savepoint using the FlinkDeployemnt with `v1beta1`:
+   ```sh
+    wget -qO - 
https://raw.githubusercontent.com/apache/flink-kubernetes-operator/main/examples/basic-checkpoint-ha.yaml|yq
 w - "spec.job.initialSavepointPath" 
"/flink-data/savepoints/savepoint-000000-aec3dd08e76d/_metadata"|kubectl apply 
-f -

Review Comment:
   Maybe instead of this somewhat random bash command we should also explain 
what is happening here that the user need to explicitly set the 
job.initialSavepointPath to the savepoint obtained from the previous job run



##########
docs/content/docs/operations/upgrade.md:
##########
@@ -0,0 +1,69 @@
+---
+title: "Upgrade"
+weight: 4
+type: docs
+aliases:
+- /operations/upgrade.html
+---
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# Upgrade CustomResourceDefinition
+During development, we delete the old CRD and create it from scratch. In an 
environment with existing deployments that is not possible, as deleting the CRD 
would wipe out all existing CRs.
+The following steps demonstrate the CRD upgrade process from `v1alpha1` to 
`v1beta1` in an environment with an existing 
[stateful](https://github.com/apache/flink-kubernetes-operator/blob/main/examples/basic-checkpoint-ha.yaml)
 job. After the CRD upgrade, the job will resumed from the savedpoint.

Review Comment:
   typo: savedpoint -> savepoint



##########
docs/content/docs/operations/upgrade.md:
##########
@@ -0,0 +1,69 @@
+---
+title: "Upgrade"
+weight: 4
+type: docs
+aliases:
+- /operations/upgrade.html
+---
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# Upgrade CustomResourceDefinition

Review Comment:
   Maybe we could change this to `# Upgrading the CRD`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to