Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Use apiextensions.k8s.io/v1 CustomResourceDefinition, rather than deprecated v1beta1 #128

Merged
merged 1 commit into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ else
endif



# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
Expand Down Expand Up @@ -52,7 +48,7 @@ deploy: manifests
# Generate manifests e.g. CRD, RBAC etc.
.PHONY: manifests
manifests: generate
$(CONTROLLER_GEN) $(CRD_OPTIONS) paths="./..." output:crd:artifacts:config=./manifests/crds/
$(CONTROLLER_GEN) crd:crdVersions=v1 paths="./..." output:crd:artifacts:config=./manifests/crds/
hack/generate-manifests.sh

.PHONY: lint
Expand Down
13 changes: 11 additions & 2 deletions api/v1alpha1/applicationset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,17 @@ type ApplicationSetSyncPolicy struct {

// ApplicationSetTemplate represents argocd ApplicationSpec
type ApplicationSetTemplate struct {
metav1.ObjectMeta `json:"metadata"`
Spec v1alpha1.ApplicationSpec `json:"spec"`
ApplicationSetTemplateMeta `json:"metadata"`
Spec v1alpha1.ApplicationSpec `json:"spec"`
}

// ApplicationSetTemplateMeta represents the Argo CD application fields that may
// be used for Applications generated from the ApplicationSet (based on metav1.ObjectMeta)
type ApplicationSetTemplateMeta struct {
Name string `json:"name,omitempty"`
Namespace string `json:"namespace,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
}

// ApplicationSetGenerator include list item info
Expand Down
31 changes: 30 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3,101 changes: 1,591 additions & 1,510 deletions manifests/crds/argoproj.io_applicationsets.yaml

Large diffs are not rendered by default.

5,313 changes: 2,684 additions & 2,629 deletions manifests/install-with-argo-cd.yaml

Large diffs are not rendered by default.

2,481 changes: 1,268 additions & 1,213 deletions manifests/install.yaml

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pkg/controllers/applicationset_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func TestExtractApplications(t *testing.T) {
name: "Generate two applications",
params: []map[string]string{{"name": "app1"}, {"name": "app2"}},
template: argoprojiov1alpha1.ApplicationSetTemplate{
ObjectMeta: metav1.ObjectMeta{
ApplicationSetTemplateMeta: argoprojiov1alpha1.ApplicationSetTemplateMeta{
Name: "name",
Namespace: "namespace",
Labels: map[string]string{"label_name": "label_value"},
Expand All @@ -100,7 +100,7 @@ func TestExtractApplications(t *testing.T) {
name: "Handles error from the render",
params: []map[string]string{{"name": "app1"}, {"name": "app2"}},
template: argoprojiov1alpha1.ApplicationSetTemplate{
ObjectMeta: metav1.ObjectMeta{
ApplicationSetTemplateMeta: argoprojiov1alpha1.ApplicationSetTemplateMeta{
Name: "name",
Namespace: "namespace",
Labels: map[string]string{"label_name": "label_value"},
Expand Down Expand Up @@ -206,22 +206,22 @@ func TestMergeTemplateApplications(t *testing.T) {
name: "Generate app",
params: []map[string]string{{"name": "app1"}},
template: argoprojiov1alpha1.ApplicationSetTemplate{
ObjectMeta: metav1.ObjectMeta{
ApplicationSetTemplateMeta: argoprojiov1alpha1.ApplicationSetTemplateMeta{
Name: "name",
Namespace: "namespace",
Labels: map[string]string{"label_name": "label_value"},
},
Spec: argov1alpha1.ApplicationSpec{},
},
overrideTemplate: argoprojiov1alpha1.ApplicationSetTemplate{
ObjectMeta: metav1.ObjectMeta{
ApplicationSetTemplateMeta: argoprojiov1alpha1.ApplicationSetTemplateMeta{
Name: "test",
Labels: map[string]string{"foo": "bar"},
},
Spec: argov1alpha1.ApplicationSpec{},
},
expectedMerged: argoprojiov1alpha1.ApplicationSetTemplate{
ObjectMeta: metav1.ObjectMeta{
ApplicationSetTemplateMeta: argoprojiov1alpha1.ApplicationSetTemplateMeta{
Name: "test",
Namespace: "namespace",
Labels: map[string]string{"label_name": "label_value", "foo": "bar"},
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/applicationset/applicationset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestSimpleListGenerator(t *testing.T) {
},
Spec: v1alpha1.ApplicationSetSpec{
Template: v1alpha1.ApplicationSetTemplate{
ObjectMeta: metav1.ObjectMeta{Name: "{{cluster}}-guestbook"},
ApplicationSetTemplateMeta: v1alpha1.ApplicationSetTemplateMeta{Name: "{{cluster}}-guestbook"},
Spec: argov1alpha1.ApplicationSpec{
Project: "default",
Source: argov1alpha1.ApplicationSource{
Expand Down Expand Up @@ -128,7 +128,7 @@ func TestSimpleGitGenerator(t *testing.T) {
},
Spec: v1alpha1.ApplicationSetSpec{
Template: v1alpha1.ApplicationSetTemplate{
ObjectMeta: metav1.ObjectMeta{Name: "{{path.basename}}"},
ApplicationSetTemplateMeta: v1alpha1.ApplicationSetTemplateMeta{Name: "{{path.basename}}"},
Spec: argov1alpha1.ApplicationSpec{
Project: "default",
Source: argov1alpha1.ApplicationSource{
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/applicationset/cluster_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestSimpleClusterGenerator(t *testing.T) {
},
Spec: v1alpha1.ApplicationSetSpec{
Template: v1alpha1.ApplicationSetTemplate{
ObjectMeta: metav1.ObjectMeta{Name: "{{name}}-guestbook"},
ApplicationSetTemplateMeta: v1alpha1.ApplicationSetTemplateMeta{Name: "{{name}}-guestbook"},
Spec: argov1alpha1.ApplicationSpec{
Project: "default",
Source: argov1alpha1.ApplicationSource{
Expand Down Expand Up @@ -157,7 +157,7 @@ func TestClusterGeneratorWithLocalCluster(t *testing.T) {
},
Spec: v1alpha1.ApplicationSetSpec{
Template: v1alpha1.ApplicationSetTemplate{
ObjectMeta: metav1.ObjectMeta{Name: "{{name}}-guestbook"},
ApplicationSetTemplateMeta: v1alpha1.ApplicationSetTemplateMeta{Name: "{{name}}-guestbook"},
Spec: argov1alpha1.ApplicationSpec{
Project: "default",
Source: argov1alpha1.ApplicationSource{
Expand Down