Updated on 2023-12-07 GMT+08:00

Applications Created Through App Designer

If the application in CCE 1.0 version is created through App Designer, follow the steps in this section to migrate the application to CCE 2.0. In CCE 2.0, use the custom Helm chart to create applications. For more information, see Chart Management.

Procedure

  1. Log in to the console of CCE 1.0. In the navigation pane, click App Manager. Then, click the name of the application to be migrated to go to the details page. Obtain Component Name and Service Name.
  2. Connect to a cluster. For details, see Connecting to a Cluster Through kubectl.
  3. Run the following commands on the kubectl client to obtain the YAML files related to the application.

    kubectl get rc new-appcomponent-1-11d3 -o yaml > new-appcomponent-1-11d3.yaml

    kubectl get svc new-port-3 -o yaml > new-port-3.yaml

    In the preceding commands, replace new-appcomponent-1-11d3 and new-port-3 with the values obtained in 1.

  4. Edit the new-appcomponent-1-11d3.yaml file by deleting the lines in bold and modifying the lines in Italic.

    apiVersion: v1
    kind: ReplicationController
    metadata:
      annotations:
        cce/app-createTimestamp: 2018-04-19-11-39-27
        cce/app-description: ""
        cce/app-updateTimestamp: 2018-04-19-11-39-27
      creationTimestamp: 2018-04-19T11:37:17Z
      generation: 1
      labels:
        cce/appgroup: app-design
        name: new-appcomponent-1-11d3
        rollingupdate: "false"
      name: new-appcomponent-1-11d3
      namespace: default
      resourceVersion: "8325781"
      selfLink: /api/v1/namespaces/default/replicationcontrollers/new-appcomponent-1-11d3
      uid: 039ada96-43c6-11e8-8f34-fa163e738aa3
    spec:
      replicas: 1
      selector:
        cce/appgroup: app-design
        name: new-appcomponent-1-11d3
        rollingupdate: "false"
      template:
        metadata:
          annotations:
            scheduler.alpha.kubernetes.io/affinity: '{"nodeAffinity":{"requiredDuringSchedulingIgnoredDuringExecution":{"nodeSelectorTerms":[{"matchExpressions":[{"key":"failure-domain.beta.kubernetes.io/zone","operator":"NotIn","values":[""]}]}]}}}'
          creationTimestamp: null
          labels:
            cce/appgroup: app-design
            name: new-appcomponent-1-11d3
            rollingupdate: "false"
        spec:
          affinity:
            nodeAffinity:
              requiredDuringSchedulingIgnoredDuringExecution:
                nodeSelectorTerms:
                - matchExpressions:
                  - key: failure-domain.beta.kubernetes.io/zone
                    operator: NotIn
                    values:
                    - ""
          containers:
          - image: 10.125.1.108:6443/test/apache-php:latest -->Change it to the image address of the later CCE version
            imagePullPolicy: Always
            name: new-container-2-11d3f16
            ports:
            - containerPort: 3333
              protocol: TCP
            resources: {}
            securityContext:
              privileged: true
            terminationMessagePath: /dev/termination-log
            terminationMessagePolicy: File
          dnsPolicy: ClusterFirst
          imagePullSecrets:
          - name: myregistry    ----->  Change it to default-secret
          restartPolicy: Always
          schedulerName: default-scheduler
          securityContext: {}
          terminationGracePeriodSeconds: 30
    status:
      availableReplicas: 1
      fullyLabeledReplicas: 1
      observedGeneration: 1
      readyReplicas: 1
      replicas: 1

  5. Open the new-port-3.yaml file, and delete the lines in bold.

    apiVersion: v1
    kind: Service
    metadata:
      creationTimestamp: 2018-04-19T11:37:17Z
      labels:
        cce/appgroup: app-design
        name: new-appcomponent-1-11d3
      name: new-port-3
      namespace: default
      resourceVersion: "8325766"
      selfLink: /api/v1/namespaces/default/services/new-port-3
      uid: 039c918f-43c6-11e8-8f34-fa163e738aa3
    spec:
      clusterIP: 10.247.145.136
      externalTrafficPolicy: Cluster
      ports:
      - name: new-port-30
        nodePort: 31471
        port: 3333
        protocol: TCP
        targetPort: 3333
      selector:
        cce/appgroup: app-design
        name: new-appcomponent-1-11d3
      sessionAffinity: None
      type: NodePort
    status:
      loadBalancer: {}

  6. Connect the kubectl client to the CCE cluster of the latest version. For details, see Connecting to a Cluster Through kubectl.
  7. Run the following commands to create the application again:

    kubectl create -f new-appcomponent-1-11d3.yaml

    kubectl create -f new-port-3.yaml