Skip to content

Use ApplyObject function for creating and updating objects

Hossein Pursultani requested to merge 581-fix-apply-config-change into master

This MR re-implements GitLabReconciler's createOrPatch function with ApplyObject, which imitates kubectl apply. It requires this function that is implemented in !476 (merged).

This MR also removes the unused return boolean argument of createOrPatch function.

Testing

  1. Deploy the Operator with latest image of this branch:

      helm upgrade \
        --install \
        gitlab-operator deploy/chart \
        --set image.tag=581-fix-apply-config-change@sha256:7513eda8ed6740b916ee8fe951ca63997ec143a7191e41bbf45287fbc648f3db
  2. Deploy a GitLab instance with:

    # example-gitlab.yaml
    apiVersion: apps.gitlab.com/v1beta1
    kind: GitLab
    metadata:
      name: example
    spec:
      chart:
        version: "6.1.0"
        values:
          global:
            hosts:
              domain: issue-581.h.k8s-ft.win
          certmanager-issuer:
            email: me@example.com
          gitlab:
            gitlab-shell:
              sshDaemon: openssh

    and then:

    kubectl apply -f example-gitlab.yaml
  3. Wait until the instance id deployed.

  4. Change gitlab.gitlab-shell.sshDaemon from openssh to gitlab-sshd and update the instance.

  5. You should see that gitlab-shell Deployment is updated successfully with the new changes.

Closes #581 (closed)

Closes #574 (closed)

Closes #683 (closed)

Closes #697 (closed)

Closes #698 (closed)

Edited by Mitchell Nielsen

Merge request reports