Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cosmo-workspace/cosmo
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.0-rc1
Choose a base ref
...
head repository: cosmo-workspace/cosmo
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: refs/heads/main
Choose a head ref

Commits on Jul 26, 2023

  1. fix charts local-run-test

    jlandowner committed Jul 26, 2023
    Copy the full SHA
    978c36d View commit details
  2. Copy the full SHA
    6ca8012 View commit details
  3. Update snapshot

    jlandowner committed Jul 26, 2023
    Copy the full SHA
    48c2eee View commit details
  4. Update snapshot

    jlandowner committed Jul 26, 2023
    Copy the full SHA
    3d0d59f View commit details
  5. Merge pull request #781 from jlandowner/fix/charts

    fix charts and local-run-test
    oruharo authored Jul 26, 2023
    Copy the full SHA
    81b5cac View commit details

Commits on Jul 28, 2023

  1. fix gc

    jlandowner committed Jul 28, 2023
    Copy the full SHA
    47d92c1 View commit details
  2. Merge pull request #783 from jlandowner/fix/gc

    Fix GC
    jlandowner authored Jul 28, 2023
    Copy the full SHA
    d4944e7 View commit details
  3. Bump version: v1.0.0-rc2

    jlandowner committed Jul 28, 2023
    Copy the full SHA
    3c3e276 View commit details

Commits on Jul 29, 2023

  1. Copy the full SHA
    3c7f291 View commit details
  2. Merge pull request #785 from jlandowner/fix/ldap

    Disable change password button when auth type is not 'password-secret'
    oruharo authored Jul 29, 2023
    Copy the full SHA
    a1c5fea View commit details
  3. Copy the full SHA
    1190b22 View commit details
  4. add UpdateUserAddons to proto

    oruharo authored and jlandowner committed Jul 29, 2023
    Copy the full SHA
    23cba31 View commit details
  5. Refacter updateUser

    jlandowner committed Jul 29, 2023
    Copy the full SHA
    6a5a88a View commit details
  6. Copy the full SHA
    a6f049e View commit details

Commits on Jul 30, 2023

  1. Merge pull request #787 from jlandowner/addons2

    Update User's Addon by UI
    oruharo authored Jul 30, 2023
    Copy the full SHA
    97eac64 View commit details

Commits on Aug 2, 2023

  1. Copy the full SHA
    bb3e7fe View commit details
  2. remove forbidden-roles

    jlandowner committed Aug 2, 2023
    Copy the full SHA
    4b40f79 View commit details
  3. Copy the full SHA
    b248e4e View commit details
  4. Copy the full SHA
    1bbf1a3 View commit details
  5. Add {{USER}} var on addon

    jlandowner committed Aug 2, 2023
    Copy the full SHA
    205b8fc View commit details
  6. Copy the full SHA
    bf76964 View commit details
  7. Copy the full SHA
    365ea3d View commit details
  8. Copy the full SHA
    6477b4a View commit details
  9. Merge pull request #793 from jlandowner/feature/required-addons

    Feature required UserAddons and improve template validation
    oruharo authored Aug 2, 2023
    Copy the full SHA
    1b22a8a View commit details
  10. Merge pull request #794 from jlandowner/change-group-admin

    Support group-admin is admin for group
    oruharo authored Aug 2, 2023
    Copy the full SHA
    d6bd69d View commit details

Commits on Aug 3, 2023

  1. Copy the full SHA
    ea9f82a View commit details
  2. Copy the full SHA
    8d6a59b View commit details
  3. Copy the full SHA
    64822a9 View commit details
  4. fix cosmoctl get ws

    jlandowner committed Aug 3, 2023
    Copy the full SHA
    bedd2e2 View commit details
  5. Copy the full SHA
    e34f63c View commit details
  6. fix cosmoctl get ws

    jlandowner committed Aug 3, 2023
    Copy the full SHA
    1eee651 View commit details
  7. Copy the full SHA
    5f47970 View commit details
  8. fix local-run-test

    jlandowner committed Aug 3, 2023
    Copy the full SHA
    8325d89 View commit details
  9. Merge pull request #795 from jlandowner/improve-cosmoctl

    Improve cosmoctl
    oruharo authored Aug 3, 2023
    Copy the full SHA
    64ad3cb View commit details
  10. Merge pull request #796 from jlandowner/fix/local-run-test

    fix local-run-test
    oruharo authored Aug 3, 2023
    Copy the full SHA
    61a1ae3 View commit details
  11. Show my user info dialog for all user

    Add change addon menu on admin app bar
    jlandowner committed Aug 3, 2023
    Copy the full SHA
    136790c View commit details
  12. fix error msg

    jlandowner committed Aug 3, 2023
    Copy the full SHA
    f7a643c View commit details
  13. Update snapshot

    jlandowner committed Aug 3, 2023
    Copy the full SHA
    cc77977 View commit details
  14. Merge pull request #799 from jlandowner/fix/ui-my-addon

    Improve UI about UserAddon infomation
    oruharo authored Aug 3, 2023
    Copy the full SHA
    65af293 View commit details
  15. fix typo

    jlandowner committed Aug 3, 2023
    Copy the full SHA
    91ed780 View commit details
  16. Merge pull request #800 from jlandowner/fix/error-msg

    Show webhook error on UI
    oruharo authored Aug 3, 2023
    Copy the full SHA
    5e302fc View commit details
  17. Bump version: v1.0.0-rc3

    jlandowner committed Aug 3, 2023
    Copy the full SHA
    a09a762 View commit details

Commits on Aug 4, 2023

  1. remove unused annotation

    jlandowner committed Aug 4, 2023
    Copy the full SHA
    51f4197 View commit details
  2. Copy the full SHA
    72a3d9e View commit details
  3. Merge pull request #802 from jlandowner/hotfix/default-addons

    Skip UserRole validation for Default UserAddon
    jlandowner authored Aug 4, 2023
    Copy the full SHA
    cf31141 View commit details
  4. Bump version: v1.0.0-rc4

    jlandowner committed Aug 4, 2023
    Copy the full SHA
    955db02 View commit details

Commits on Aug 6, 2023

  1. Copy the full SHA
    c66f47c View commit details
  2. Merge pull request #803 from jlandowner/feature/#753

    keep search string and filter roles state in URL param
    oruharo authored Aug 6, 2023
    Copy the full SHA
    87de2eb View commit details

Commits on Aug 10, 2023

  1. backoff

    jlandowner committed Aug 10, 2023
    Copy the full SHA
    e5d6fe1 View commit details

Commits on Aug 11, 2023

  1. Copy the full SHA
    b123690 View commit details
Showing 432 changed files with 64,844 additions and 40,747 deletions.
58 changes: 29 additions & 29 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -13,12 +13,12 @@ name: "CodeQL"

on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]
schedule:
- cron: '15 10 * * 3'
- cron: "15 10 * * 3"

jobs:
analyze:
@@ -32,40 +32,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'go', 'javascript' ]
language: ["go", "javascript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
44 changes: 8 additions & 36 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
@@ -33,14 +33,16 @@ jobs:
- update-source
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Setup Go
uses: actions/setup-go@v2
uses: actions/checkout@v4
with:
go-version: "1.20"
go-version-file: go.mod
- run: go version

- name: Create tag
run: |
git tag v${{ inputs.version }}
@@ -75,7 +77,7 @@ jobs:
- create-release
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
@@ -105,7 +107,7 @@ jobs:
- create-release
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
@@ -128,33 +130,3 @@ jobs:
tags: ghcr.io/${{ github.repository_owner }}/cosmo-dashboard:${{ needs.create-release.outputs.tag }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

docker-build-traefik-plugins:
runs-on: ubuntu-latest
needs:
- create-release
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
file: dockerfile/traefik-plugins.Dockerfile
tags: ghcr.io/${{ github.repository_owner }}/cosmo-traefik-plugins:${{ needs.create-release.outputs.tag }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -29,4 +29,5 @@ bin
*.crt
*.cert

config/crd/traefik
config/crd/traefik
cmd/controller-manager/traefik-plugins.tar.gz
3 changes: 2 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
version: 2
before:
hooks:
- go mod tidy
@@ -22,4 +23,4 @@ archives:
release:
draft: true
changelog:
skip: true
disable: true
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -7,4 +7,10 @@
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
43 changes: 20 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
@@ -7,13 +7,11 @@ QUICK_BUILD ?= no
MANAGER_VERSION ?= $(VERSION)
DASHBOARD_VERSION ?= $(VERSION)
COSMOCTL_VERSION ?= $(VERSION)
TRAEFIK_PLUGINS_VERSION ?= $(VERSION)

CHART_VERSION ?= $(VERSION)

IMG_MANAGER ?= cosmo-controller-manager:$(MANAGER_VERSION)
IMG_DASHBOARD ?= cosmo-dashboard:$(DASHBOARD_VERSION)
IMG_TRAEFIK_PLUGINS ?= cosmo-traefik-plugins:$(TRAEFIK_PLUGINS_VERSION)
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:generateEmbeddedObjectMeta=true"

@@ -53,6 +51,7 @@ all: manager cosmoctl dashboard
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
ifeq ($(QUICK_BUILD),no)
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./api/..." output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./internal/webhooks" output:crd:artifacts:config=config/crd/bases
endif

.PHONY: generate
@@ -72,21 +71,21 @@ ifeq ($(QUICK_BUILD),no)
endif

.PHONY: vet
vet: go ## Run go vet against code.
vet: go embed-traefik-plugins ## Run go vet against code.
ifeq ($(QUICK_BUILD),no)
$(GO) vet ./...
endif

##---------------------------------------------------------------------
##@ Test
##---------------------------------------------------------------------
TEST_FILES ?= ./... ./traefik/plugins/cosmo-workspace/cosmoauth/
TEST_FILES ?= ./... ./traefik-plugins/src/github.com/cosmo-workspace/cosmoauth/
COVER_PROFILE ?= cover.out
#TEST_OPTS ?= --ginkgo.focus 'Dashboard server \[User\]' -ginkgo.v -ginkgo.progress -test.v > test.out 2>&1

.PHONY: clear-snapshots
clear-snapshots: ## Clear snapshots
-find . -type f | grep __snapshots__ | grep -v "/web/" | xargs rm -f
-find . -type f | grep __snapshots__ | grep -v "/web/" | grep -v "/charts/" | xargs rm -f

.PHONY: ingressroute.yaml
ingressroute.yaml: helm config/crd/traefik/traefik.io_ingressroutes.yaml
@@ -113,9 +112,9 @@ endif
.PHONY: test-all-k8s-versions
test-all-k8s-versions: go manifests generate fmt vet envtest ## Run tests on targeting k8s versions.
ifeq ($(QUICK_BUILD),no)
-KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use 1.26.x -p path)" $(GO) test ./... -coverprofile $(COVER_PROFILE)
-KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use 1.25.x -p path)" $(GO) test ./... -coverprofile $(COVER_PROFILE)
-KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use 1.24.x -p path)" $(GO) test ./... -coverprofile $(COVER_PROFILE)
-KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use 1.30.x -p path)" $(GO) test ./... -coverprofile $(COVER_PROFILE)
-KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use 1.29.x -p path)" $(GO) test ./... -coverprofile $(COVER_PROFILE)
-KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use 1.28.x -p path)" $(GO) test ./... -coverprofile $(COVER_PROFILE)
endif

.PHONY: clear-snapshots-ui
@@ -203,11 +202,17 @@ run: go generate fmt vet manifests ## Run controller-manager against the configu
--metrics-bind-address :8085 \
--cert-dir .

embed-traefik-plugins: cmd/controller-manager/traefik-plugins.tar.gz
cmd/controller-manager/traefik-plugins.tar.gz:
make -C traefik-plugins/src/github.com/cosmo-workspace/cosmoauth vendor
cd traefik-plugins && tar zcvf traefik-plugins.tar.gz src/
mv traefik-plugins/traefik-plugins.tar.gz cmd/controller-manager/

##---------------------------------------------------------------------
##@ Docker build
##---------------------------------------------------------------------
.PHONY: docker-build
docker-build: docker-build-manager docker-build-dashboard docker-build-traefik-plugins ## Build the docker image.
docker-build: docker-build-manager docker-build-dashboard ## Build the docker image.

.PHONY: docker-build-manager
docker-build-manager: test ## Build the docker image for controller-manager.
@@ -217,12 +222,8 @@ docker-build-manager: test ## Build the docker image for controller-manager.
docker-build-dashboard: test ## Build the docker image for dashboard.
DOCKER_BUILDKIT=1 docker build . -t ${IMG_DASHBOARD} -f dockerfile/dashboard.Dockerfile

.PHONY: docker-build-traefik-plugins
docker-build-traefik-plugins: test ## Build the docker image for traefik-plugins.
DOCKER_BUILDKIT=1 docker build . -t ${IMG_TRAEFIK_PLUGINS} -f dockerfile/traefik-plugins.Dockerfile

.PHONY: docker-push docker-push-manager docker-push-dashboard docker-push-traefik-plugins
docker-push: docker-push-manager docker-push-dashboard docker-push-traefik-plugins ## Build the docker image.
.PHONY: docker-push docker-push-manager docker-push-dashboard
docker-push: docker-push-manager docker-push-dashboard ## Build the docker image.

REGISTORY ?= ghcr.io/cosmo-workspace

@@ -234,10 +235,6 @@ docker-push-dashboard: docker-build-dashboard ## push cosmo dashboard image.
docker tag ${IMG_DASHBOARD} ${REGISTORY}/${IMG_DASHBOARD}
docker push ${REGISTORY}/${IMG_DASHBOARD}

docker-push-traefik-plugins: docker-build-traefik-plugins ## push cosmo traefik-plugins image.
docker tag ${IMG_TRAEFIK_PLUGINS} ${REGISTORY}/${IMG_TRAEFIK_PLUGINS}
docker push ${REGISTORY}/${IMG_TRAEFIK_PLUGINS}

##---------------------------------------------------------------------
##@ Deployment
##---------------------------------------------------------------------
@@ -266,12 +263,12 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi
##---------------------------------------------------------------------

## Tool Versions
GO_VERSION ?= 1.20.4
KUSTOMIZE_VERSION ?= v5.0.1
CONTROLLER_TOOLS_VERSION ?= v0.12.0
GO_VERSION ?= 1.22.3
KUSTOMIZE_VERSION ?= v5.4.1
CONTROLLER_TOOLS_VERSION ?= v0.15.0

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION ?= 1.26.x
ENVTEST_K8S_VERSION ?= 1.30.x

## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
7 changes: 7 additions & 0 deletions api/v1alpha1/instance_types.go
Original file line number Diff line number Diff line change
@@ -12,6 +12,13 @@ const (
LabelKeyInstanceName = "cosmo-workspace.github.io/instance"
// LabelKeyTemplateName is a template name label on the resources created by instance
LabelKeyTemplateName = "cosmo-workspace.github.io/template"

// ResourceAnnKeyDeletePolicy is a annotation key on the resources created by instance controller to specify delete policy
ResourceAnnKeyDeletePolicy = "cosmo-workspace.github.io/delete-policy"
// ResourceAnnEnumDeletePolicyDelete is delete policy, which controller do garbage collenction and attach owner references (default)
ResourceAnnEnumDeletePolicyDelete = "delete"
// ResourceAnnEnumDeletePolicyKeep is keep policy, which controller do not do garbage collenction and do not attach owner references
ResourceAnnEnumDeletePolicyKeep = "keep"
)

func init() {
7 changes: 2 additions & 5 deletions api/v1alpha1/template_types.go
Original file line number Diff line number Diff line change
@@ -13,13 +13,10 @@ const (

// TemplateAnnKeyDisableNamePrefix is an annotation key on Template to notify controller not to add name prefix
TemplateAnnKeyDisableNamePrefix = "cosmo-workspace.github.io/disable-nameprefix"
// TemplateAnnKeySkipValidation is an annotation key on Template to notify webhook not to validate
TemplateAnnKeySkipValidation = "cosmo-workspace.github.io/skip-validation"

// TemplateAnnKeyUserRoles is an annotation key on Template for specific UserRoles
TemplateAnnKeyUserRoles = "cosmo-workspace.github.io/userroles"
// TemplateAnnKeyForbiddenUserRoles is an annotation key on Template which is not for specific UserRoles
TemplateAnnKeyForbiddenUserRoles = "cosmo-workspace.github.io/forbidden-userroles"
// TemplateAnnKeyRequiredAddons is a annotation key for Template which requires useraddons
TemplateAnnKeyRequiredAddons = "cosmo-workspace.github.io/required-useraddons"
)

func init() {
21 changes: 16 additions & 5 deletions api/v1alpha1/user_types.go
Original file line number Diff line number Diff line change
@@ -29,7 +29,10 @@ const NamespaceLabelKeyUserName = "cosmo-workspace.github.io/user"
const UserAddonTemplateAnnKeyDefaultUserAddon = "useraddon.cosmo-workspace.github.io/default"

// Var for user addon
const TemplateVarUserName = "{{USER_NAME}}"
const (
TemplateVarUser = "{{USER}}"
TemplateVarUserName = "{{USER_NAME}}"
)

const UserNamespacePrefix = "cosmo-user-"

@@ -78,9 +81,10 @@ type UserSpec struct {
}

type UserStatus struct {
Phase corev1.NamespacePhase `json:"phase,omitempty"`
Namespace ObjectRef `json:"namespace,omitempty"`
Addons []ObjectRef `json:"addons,omitempty"`
Phase corev1.NamespacePhase `json:"phase,omitempty"`
Namespace ObjectRef `json:"namespace,omitempty"`
Addons []ObjectRef `json:"addons,omitempty"`
SharedWorkspaces []ObjectRef `json:"sharedWorkspaces,omitempty"`
}

type UserAddon struct {
@@ -105,7 +109,14 @@ type UserRole struct {
func (r UserRole) GetGroupAndRole() (group string, role string) {
v := strings.Split(r.Name, "-")
if len(v) > 0 {
return strings.Join(v[:len(v)-1], "-"), v[len(v)-1]
group := strings.Join(v[:len(v)-1], "-")
role := v[len(v)-1]

if group == "" {
return r.Name, ""
}

return group, role
}
return r.Name, ""
}
Loading