From 6fd4777f8e93e72af4e60879a5e2bc59c4b6b29e Mon Sep 17 00:00:00 2001 From: Peng Zhou <27710236+pengzhouml@users.noreply.github.com> Date: Tue, 20 Aug 2024 22:22:10 -0700 Subject: [PATCH 1/2] MLE-16012 EA1 Release update (#18) * MLE-16012 Update GitHub action to work with private repo * Update README for Private Repo --------- Co-authored-by: Peng Zhou --- .github/workflows/release.yaml | 39 ++++++++++++++++++++++++++-------- README.md | 39 ++++++++++++++++++++++++++++------ 2 files changed, 62 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2d3bcdd..2ed2ff7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,5 +1,7 @@ name: Release Charts +concurrency: release-helm + on: push: branches: @@ -14,22 +16,41 @@ jobs: - name: Checkout uses: actions/checkout@v3 with: + path: 'src' + ref: 'main' + fetch-depth: 0 + + - name: Checkout + uses: actions/checkout@v3 + with: + path: 'dest' + ref: 'gh-pages' fetch-depth: 0 - name: Configure Git run: | + cd dest git config user.name "$GITHUB_ACTOR" git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - name: Install Helm uses: azure/setup-helm@v4 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Run chart-releaser - uses: helm/chart-releaser-action@v1.6.0 - with: - charts_dir: 'charts' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CR_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + - name: Package Helm Charts + shell: bash + run: | + find src/charts/ -type f -name 'Chart.yaml' | sed -r 's|/[^/]+$||' | sort | uniq | xargs -L 1 helm dep up + for d in src/charts/*/ ; do + echo "$d" + helm package "$d" -u -d dest + done + + - name: Push New Files + shell: bash + working-directory: dest + run: | + helm repo index . --url https://raw.githubusercontent.com/pengzhouml/marklogic-kubernetes-operator/gh-pages/ + git add $(git ls-files -o --exclude-standard) + git add index.yaml + git commit -m "Updated from ref: $GITHUB_SHA" + git push diff --git a/README.md b/README.md index 49b9eb9..942de4e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# MarkLogic Kubernetes Operator +# MarkLogic Kubernetes Operator (Private Repo) ## Introduction @@ -14,7 +14,29 @@ pkg/ Contains golang packges to support reconciliation, utilities. ## Run or deploy Operator +### Deploy Operator with Helm Chart in Private Repo +The EA release is currently in a private repository. To access and work with this private repository, please follow these steps: +1. First you need to create a Fine-grained tokens in Github with Read-only permission for marklogic/marklogic-kubernetes-operator repository + Once you have the token, put store it in a safe place and put it in the environmental variable: +```sh +GITHUB_TOKEN= +``` +2. Then add the private repo to Helm repository with the GITHUB_TOKEN: +```sh +helm repo add marklogic-private https://raw.githubusercontent.com/marklogic/marklogic-kubernetes-operator/gh-pages/ --username --password $GITHUB_TOKEN +helm repo update +``` +3. Install the Helm Chart for MarkLogic Operator: +```sh +helm upgrade marklogic-operator marklogic-private/marklogic-operator --version=1.0.0-ea1 --install --namespace marklogic-operator-system --create-namespace +``` +4. Check the Operator Pod and make sure it is in Running state: +```sh +kubectl get pods -n marklogic-operator-system +``` + ### Run Operator locally +After checking out the source code, you can run the MarkLogic Operator locally by following these steps: ```sh make build # build the project make install # instal CRD to Kubernetes cluster @@ -22,6 +44,7 @@ make run # run the operator controller locally ``` ### Deploy Operator locally +After checking out the source code, you can deploy the MarkLogic Operator locally by following these steps: ```sh make build # build the project make docker-build # build the operator to docker image @@ -29,15 +52,17 @@ make docker-push # push the operator to remote docker repo make deploy # deploy the CRD and Operator into marklogic-operator-system namespace ``` -### Deploy Operator with Helm Chart -1. Add the Helm repository: +### Build Helm Chart locally +If you don't have the GITHUB_TOKEN that is required to visit the Github Repo, you can also build the Helm Chart locally. +First build the Helm Chart ```sh -helm repo add marklogic-operator https://marklogic.github.io/marklogic-kubernetes-operator/ +make build +make docker-build +make helm ``` - -2. Install the Helm Chart for MarkLogic Operator: +Then deploy the Operator with Helm Chart ```sh -helm upgrade marklogic-operator marklogic-operator/marklogic-operator --install --namespace marklogic-operator-system --create-namespace +helm upgrade marklogic-operator ./charts/marklogic-operator --install --namespace marklogic-operator-system --create-namespace ``` ## Install MarkLogic Cluster with MarkLogic Operator From 55c1477272efe2cafdd3a732328417908f47a4fb Mon Sep 17 00:00:00 2001 From: Peng Zhou <27710236+pengzhouml@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:14:14 -0700 Subject: [PATCH 2/2] MLE-16012: fix the repo URL (#19) Co-authored-by: Peng Zhou --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2ed2ff7..f36c4dd 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -49,7 +49,7 @@ jobs: shell: bash working-directory: dest run: | - helm repo index . --url https://raw.githubusercontent.com/pengzhouml/marklogic-kubernetes-operator/gh-pages/ + helm repo index . --url https://raw.githubusercontent.com/marklogic/marklogic-kubernetes-operator/gh-pages/ git add $(git ls-files -o --exclude-standard) git add index.yaml git commit -m "Updated from ref: $GITHUB_SHA"