Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update gitea chart from 8.3.0 to 10.0.0 #2123

Merged
merged 57 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
329fce1
chore: update gitea chart version
TristanHoladay Oct 31, 2023
87a753a
wip: refactoring gitea-values and zarf.yaml
TristanHoladay Nov 1, 2023
eb9f0c6
Merge branch 'defenseunicorns:main' into gitea-chart-update
TristanHoladay Nov 2, 2023
41de1bb
wip: set git-server replicaCount back to zarf var.
TristanHoladay Nov 2, 2023
1b61a42
Merge branch 'main' into gitea-chart-update
Racer159 Nov 6, 2023
ba398ce
wip: update expected gitea version for create_sbom_test
TristanHoladay Nov 6, 2023
14e4778
wip: added scope to Artifact token to read:user
TristanHoladay Nov 7, 2023
b97277f
Merge branch 'main' into gitea-chart-update
TristanHoladay Nov 7, 2023
ab28c3c
wip: updated gitea config values to better match recommended configur…
TristanHoladay Nov 9, 2023
bbe003f
wip: merged main and resolved conflict in gitea zarf.yaml
TristanHoladay Nov 9, 2023
9c50d16
Merge branch 'defenseunicorns:main' into gitea-chart-update
TristanHoladay Nov 15, 2023
cf44d56
Merge branch 'defenseunicorns:main' into gitea-chart-update
TristanHoladay Nov 16, 2023
087d381
wip: set existing server pvc name default to pvc name from 8.3.0; add…
TristanHoladay Nov 17, 2023
97fcf40
wip: iterating on updatig gitea creds via api instead of updated helm…
TristanHoladay Nov 17, 2023
ba3f764
wip: merged main and resolved
TristanHoladay Nov 27, 2023
00cd24c
wip: update-creds api calls refactors
TristanHoladay Nov 27, 2023
48558c6
wip: removed has read only user check from CreateReadOnlyUser()
TristanHoladay Nov 27, 2023
3c48cad
Merge branch 'defenseunicorns:main' into gitea-chart-update
TristanHoladay Nov 27, 2023
b70d100
wip: revert zarf var for gitea claim name to git_server_existing_pvc
TristanHoladay Nov 27, 2023
8613702
wip: added comments to new gitea.go methods for updating users
TristanHoladay Nov 27, 2023
a1e832f
wip: removed comment from gitea zarf.yaml
TristanHoladay Nov 27, 2023
e826833
Merge branch 'main' into gitea-chart-update
TristanHoladay Nov 27, 2023
9cfc214
Merge branch 'main' into gitea-chart-update
TristanHoladay Nov 29, 2023
ba579f0
wip: merge main and resolve
TristanHoladay Nov 30, 2023
5ed83ae
wip: fix h.cfg case typo
TristanHoladay Nov 30, 2023
9d2cf21
Merge branch 'main' into gitea-chart-update
TristanHoladay Dec 1, 2023
bea7886
wip: refactored UpdateZarfGiteaValues() and moved to gitea.go; refact…
TristanHoladay Dec 6, 2023
be43800
Merge branch 'main' into gitea-chart-update
TristanHoladay Dec 6, 2023
99304c9
wip: add comment to UpdateGitUser() since it is exported
TristanHoladay Dec 6, 2023
7716b62
Merge branch 'main' into gitea-chart-update
TristanHoladay Dec 8, 2023
d311871
Merge branch 'main' into gitea-chart-update
Racer159 Dec 11, 2023
06feb72
wip: adding read and write package scopes for git token
TristanHoladay Dec 11, 2023
1066387
Merge branch 'main' into gitea-chart-update
TristanHoladay Dec 12, 2023
f778568
wip: rename UpdateZarfGiteaValues to UpdateZarfGiteaUsers
TristanHoladay Dec 12, 2023
5fb6b3f
Merge branch 'main' into gitea-chart-update
TristanHoladay Dec 13, 2023
ee4f876
Merge branch 'main' into gitea-chart-update
Racer159 Dec 15, 2023
59bb085
Merge branch 'main' into gitea-chart-update
Racer159 Dec 15, 2023
b127bb2
wip: create zarf internal update-gitea-pvc process
TristanHoladay Dec 15, 2023
4351dad
wip: adding roll back to update-gitea-pvc cmd
TristanHoladay Dec 15, 2023
ebfd7cd
wip: fix testing bug
TristanHoladay Dec 15, 2023
29f2b27
wip: fix UpdateGiteaPVC() custom claim logic; refactor AddLabelsAndAn…
TristanHoladay Dec 15, 2023
f263b22
Merge branch 'main' into gitea-chart-update
Racer159 Dec 15, 2023
f9e57ec
Merge branch 'main' into gitea-chart-update
TristanHoladay Dec 16, 2023
3ba7f4d
Merge branch 'main' into gitea-chart-update
Racer159 Dec 16, 2023
b8fdf4d
wip: minor refactors
TristanHoladay Dec 18, 2023
2cff54f
Merge branch 'main' into gitea-chart-update
TristanHoladay Dec 18, 2023
892f6a1
wip: updating gitea chart version to 10.0.0 -- updating gitea values …
TristanHoladay Dec 18, 2023
1fba065
wip: update e2e sbom test gitea version.
TristanHoladay Dec 18, 2023
7ce9de5
Merge branch 'main' into gitea-chart-update
Racer159 Dec 19, 2023
21a9c7d
wip: moved wait and added 422 check in CreateReadOnlyUser()
TristanHoladay Dec 19, 2023
ecf13b2
wip: removing else blocks in UpdateGiteaPVC() according GH Actions Va…
TristanHoladay Dec 19, 2023
6f24e90
wip: add statusCode to return of DoHTTPThings(); check statusCode in …
TristanHoladay Dec 19, 2023
ef009c5
fix linting issue
Racer159 Dec 19, 2023
07a6060
Update src/pkg/k8s/dynamic.go
Racer159 Dec 19, 2023
e754b54
Update zarf-config.toml
Racer159 Dec 19, 2023
0f8ec5a
Update src/test/e2e/06_create_sbom_test.go
Racer159 Dec 19, 2023
f838e10
Update src/test/e2e/06_create_sbom_test.go
Racer159 Dec 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions docs/5-zarf-tutorials/8-custom-init-packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,10 @@ $ zarf package create . \
--set REGISTRY_IMAGE_TAG=2.8.3 \
--set REGISTRY_IMAGE="opensource/registry" \
--set REGISTRY_IMAGE_DOMAIN="custom.enterprise.corp" \
--set GITEA_IMAGE="custom.enterprise.corp/opensource/gitea" \
--set GITEA_SERVER_VERSION="v1.19.3"
--set GITEA_IMAGE="custom.enterprise.corp/opensource/gitea:v1.21.0-rootless"
```

⚠️ - The Gitea image and version are different than the Agent and Registry in that Zarf will always prefer the `rootless` version of a given server image. This means that the above reference would template out to be `custom.enterprise.corp/opensource/gitea:v1.19.3-rootless`. If you need to change this, edit the `packages/gitea` package.
⚠️ - The Gitea image is different from the Agent and Registry in that Zarf will always prefer the `rootless` version of a given server image. The image no longer must be tagged with `-rootless`, but it still needs to implement the [Gitea configuration of a rootless image](https://github.com/go-gitea/gitea/blob/main/Dockerfile.rootless). If you need to change this, edit the `packages/gitea` package.

You can find all of the `--set` configurations by looking at the `zarf-config.toml` in the root of the repository.

Expand Down
24 changes: 15 additions & 9 deletions packages/gitea/gitea-values.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
persistence:
storageClass: "###ZARF_STORAGE_CLASS###"
existingClaim: "###ZARF_VAR_GIT_SERVER_EXISTING_PVC###"
claimName: "###ZARF_VAR_GIT_SERVER_EXISTING_PVC###"
size: "###ZARF_VAR_GIT_SERVER_PVC_SIZE###"
accessModes:
- "###ZARF_VAR_GIT_SERVER_PVC_ACCESS_MODE###"
create: ###ZARF_VAR_GIT_SERVER_CREATE_PVC###

replicaCount: "###ZARF_VAR_GIT_SERVER_REPLICA_COUNT###"
replicaCount: ###ZARF_VAR_GIT_SERVER_REPLICA_COUNT###

gitea:
admin:
Expand All @@ -29,6 +30,12 @@ gitea:
repository:
ENABLE_PUSH_CREATE_USER: true
FORCE_PRIVATE: true
session:
PROVIDER: memory
cache:
ADAPTER: memory
queue:
TYPE: level
resources:
requests:
cpu: "###ZARF_VAR_GIT_SERVER_CPU_REQ###"
Expand All @@ -37,13 +44,12 @@ resources:
cpu: "###ZARF_VAR_GIT_SERVER_CPU_LIMIT###"
memory: "###ZARF_VAR_GIT_SERVER_MEM_LIMIT###"

memcached:
enabled: false
image:
fullOverride: "###ZARF_CONST_GITEA_IMAGE###"
rootless: true

postgresql:
postgresql-ha:
enabled: false

image:
repository: "###ZARF_CONST_GITEA_IMAGE###"
tag: "###ZARF_CONST_GITEA_SERVER_VERSION###"
rootless: true
redis-cluster:
enabled: false
28 changes: 17 additions & 11 deletions packages/gitea/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
variables:
- name: GIT_SERVER_EXISTING_PVC
description: "Optional: Use an existing PVC for the git server instead of creating a new one. If this is set, the GIT_SERVER_PVC_SIZE variable will be ignored."
default: ""
default: "data-zarf-gitea-0"

- name: GIT_SERVER_PVC_SIZE
description: The size of the persistent volume claim for the git server
Expand Down Expand Up @@ -42,16 +42,14 @@ variables:
constants:
- name: GITEA_IMAGE
value: "###ZARF_PKG_TMPL_GITEA_IMAGE###"
- name: GITEA_SERVER_VERSION
value: "###ZARF_PKG_TMPL_GITEA_SERVER_VERSION###"

components:
- name: git-server
description: |
Deploys Gitea to provide git repositories for Kubernetes configurations.
Required for GitOps deployments if no other git server is available.
images:
- "###ZARF_PKG_TMPL_GITEA_IMAGE###:###ZARF_PKG_TMPL_GITEA_SERVER_VERSION###-rootless"
- "###ZARF_PKG_TMPL_GITEA_IMAGE###"
manifests:
- name: git-connect
namespace: zarf
Expand All @@ -61,13 +59,24 @@ components:
- name: gitea
releaseName: zarf-gitea
url: https://dl.gitea.io/charts
version: 8.3.0
version: 10.0.0
namespace: zarf
valuesFiles:
- gitea-values.yaml
actions:
onDeploy:
before:
- cmd: ./zarf internal update-gitea-pvc --no-progress
setVariables:
- name: GIT_SERVER_CREATE_PVC
mute: true
after:
- wait:
cluster:
kind: pod
namespace: zarf
name: app=gitea
condition: Ready
- cmd: ./zarf internal create-read-only-gitea-user --no-progress
maxRetries: 3
maxTotalSeconds: 60
Expand All @@ -76,9 +85,6 @@ components:
maxRetries: 3
maxTotalSeconds: 60
description: Create an artifact registry token
- wait:
cluster:
kind: pod
namespace: zarf
name: app=gitea
condition: Ready

onFailure:
- cmd: ./zarf internal update-gitea-pvc --rollback --no-progress
23 changes: 23 additions & 0 deletions src/cmd/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ import (
"github.com/spf13/pflag"
)

var (
rollback bool
)

var internalCmd = &cobra.Command{
Use: "internal",
Hidden: true,
Expand Down Expand Up @@ -196,6 +200,22 @@ var createPackageRegistryToken = &cobra.Command{
},
}

var updateGiteaPVC = &cobra.Command{
Use: "update-gitea-pvc",
Short: lang.CmdInternalUpdateGiteaPVCShort,
Long: lang.CmdInternalUpdateGiteaPVCLong,
Run: func(cmd *cobra.Command, args []string) {

// There is a possibility that the pvc does not yet exist and Gitea helm chart should create it
helmShouldCreate, err := git.UpdateGiteaPVC(rollback)
if err != nil {
message.WarnErr(err, lang.CmdInternalUpdateGiteaPVCErr)
}

fmt.Print(helmShouldCreate)
},
}

var isValidHostname = &cobra.Command{
Use: "is-valid-hostname",
Short: lang.CmdInternalIsValidHostnameShort,
Expand Down Expand Up @@ -229,8 +249,11 @@ func init() {
internalCmd.AddCommand(genTypesSchemaCmd)
internalCmd.AddCommand(createReadOnlyGiteaUser)
internalCmd.AddCommand(createPackageRegistryToken)
internalCmd.AddCommand(updateGiteaPVC)
internalCmd.AddCommand(isValidHostname)
internalCmd.AddCommand(computeCrc32)

updateGiteaPVC.Flags().BoolVarP(&rollback, "rollback", "r", false, lang.CmdInternalFlagUpdateGiteaPVCRollback)
}

func addHiddenDummyFlag(cmd *cobra.Command, flagDummy string) {
Expand Down
3 changes: 2 additions & 1 deletion src/cmd/tools/zarf.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ var updateCredsCmd = &cobra.Command{
}
}
if slices.Contains(args, message.GitKey) && newState.GitServer.InternalServer {
err = h.UpdateZarfGiteaValues()
g := git.New(newState.GitServer)
err = g.UpdateZarfGiteaUsers(oldState)
if err != nil {
// Warn if we couldn't actually update the git server (it might not be installed and we should try to continue)
message.Warnf(lang.CmdToolsUpdateCredsUnableUpdateGit, err.Error())
Expand Down
6 changes: 6 additions & 0 deletions src/config/lang/english.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ $ zarf init --artifact-push-password={PASSWORD} --artifact-push-username={USERNA
"This is called internally by the supported Gitea package component."
CmdInternalArtifactRegistryGiteaTokenErr = "Unable to create an artifact registry token for the Gitea service."

CmdInternalUpdateGiteaPVCShort = "Updates an existing Gitea persistent volume claim"
CmdInternalUpdateGiteaPVCLong = "Updates an existing Gitea persistent volume claim by assessing if claim is a custom user provided claim or default." +
"This is called internally by the supported Gitea package component."
CmdInternalUpdateGiteaPVCErr = "Unable to update the existing Gitea persistent volume claim."
CmdInternalFlagUpdateGiteaPVCRollback = "Roll back previous Gitea persistent volume claim updates."

CmdInternalIsValidHostnameShort = "Checks if the current machine's hostname is RFC1123 compliant"
CmdInternalIsValidHostnameErr = "The hostname '%s' is not valid. Ensure the hostname meets RFC1123 requirements https://www.rfc-editor.org/rfc/rfc1123.html."

Expand Down
Loading
Loading