-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(spacetemplates): Provide pre-configured templates for creating s…
…paces feat(spacetemplates): Provide pre-configured templates for creating spaces
- Loading branch information
Showing
47 changed files
with
5,069 additions
and
456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Golang Unit tests | ||
|
||
on: | ||
push: | ||
branches: [ "*" ] | ||
pull_request: | ||
branches: [ "*" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go-version: [ '1.19', '1.20', '1.21.x' ] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Install dependencies | ||
run: go get . | ||
- name: Run unit tests with Go CLI | ||
run: go test ./... -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,7 +114,7 @@ apidoc: apidocs-gen ## Generate CRD Documentation | |
|
||
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint | ||
golangci-lint: ## Download golangci-lint locally if necessary. | ||
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2) | ||
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2) | ||
|
||
# Linting code as PR is expecting | ||
.PHONY: golint | ||
|
@@ -193,13 +193,14 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi | |
# Helm | ||
SRC_ROOT = $(shell git rev-parse --show-toplevel) | ||
|
||
HELM_DOCS = $(shell pwd)/bin/helm-docs | ||
.PHONY: helm-docs-ensure | ||
helm-docs-ensure: ## Download helm-docs locally if necessary. | ||
$(call go-install-tool,$(HELM_DOCS),github.com/norwoodj/helm-docs/cmd/[email protected]) | ||
|
||
.PHONY: helm-docs | ||
helm-docs: HELMDOCS_VERSION := v1.11.0 | ||
helm-docs: docker ## Run helm-docs within docker. | ||
@docker run --rm -v "$(SRC_ROOT):/helm-docs" jnorwood/helm-docs:$(HELMDOCS_VERSION) --chart-search-root /helm-docs | ||
|
||
|
||
helm-docs: helm-docs-ensure ## Run helm-docs. | ||
$(HELM_DOCS) --chart-search-root $(shell pwd)/charts | ||
|
||
.PHONY: helm-lint | ||
helm-lint: docker ## Run ct test linter in docker. | ||
|
@@ -255,3 +256,7 @@ $(CONTROLLER_GEN): $(LOCALBIN) | |
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary. | ||
$(ENVTEST): $(LOCALBIN) | ||
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest | ||
|
||
|
||
.PHONY: merge-request | ||
merge-request: manifests installer golint apidoc helm-docs ## Run Local checks before a opening merge request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright 2022-2023 Edixos | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! | ||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. | ||
|
||
// SpaceTemplateSpec defines the desired state of SpaceTemplate. | ||
type SpaceTemplateSpec struct { | ||
// Specifies a list of ResourceQuota resources assigned to the Space. The assigned values are inherited by the namespace created by the Space. Optional. | ||
ResourceQuota corev1.ResourceQuotaSpec `json:"resourceQuota,omitempty"` | ||
// Specifies additional RoleBindings assigned to the Space. Nauticus will ensure that the namespace in the Space always contain the RoleBinding for the given ClusterRole. Optional. | ||
AdditionalRoleBindings AdditionalRoleBindingsSpec `json:"additionalRoleBindings,omitempty"` | ||
// Specifies the NetworkPolicies assigned to the Tenant. The assigned NetworkPolicies are inherited by the namespace created in the Space. Optional. | ||
NetworkPolicies NetworkPolicies `json:"networkPolicies,omitempty"` | ||
// Specifies the resource min/max usage restrictions to the Space. Optional. | ||
LimitRanges LimitRangesSpec `json:"limitRanges,omitempty"` | ||
} | ||
|
||
// SpaceTemplateStatus defines the observed state of SpaceTemplate. | ||
type SpaceTemplateStatus struct { | ||
// Conditions List of status conditions to indicate the status of Space | ||
Conditions []metav1.Condition `json:"conditions,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:scope=Cluster, categories={spacetemplate} | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Age" | ||
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status",description="Ready" | ||
|
||
// SpaceTemplate is the Schema for the spacetemplates API. | ||
type SpaceTemplate struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec SpaceTemplateSpec `json:"spec,omitempty"` | ||
Status SpaceTemplateStatus `json:"status,omitempty"` | ||
} | ||
|
||
func (in *SpaceTemplate) GetConditions() []metav1.Condition { | ||
return in.Status.Conditions | ||
} | ||
|
||
func (in *SpaceTemplate) SetConditions(conditions []metav1.Condition) { | ||
in.Status.Conditions = conditions | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// SpaceTemplateList contains a list of SpaceTemplate. | ||
type SpaceTemplateList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []SpaceTemplate `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&SpaceTemplate{}, &SpaceTemplateList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.