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

feat: init ApisixPluginConfig crd #4 (#638) #694

Merged
merged 15 commits into from
Nov 24, 2021

Conversation

neverCase
Copy link
Contributor

@neverCase neverCase commented Sep 26, 2021

Please answer these questions before submitting a pull request


Bugfix

  • Description

  • How to fix?


New feature or improvement

  • Describe the details and related test reports.

Backport patches

  • Why need to backport?

  • Source branch

  • Related commits and pull requests

  • Target branch

@neverCase
Copy link
Contributor Author

@tao12345666333

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:subresource:status
// +kubebuilder:object:generate=true
// +kubebuilder:printcolumn:name="Id",type="date",JSONPath=".metadata.namespace"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the type is incorrect

Copy link
Contributor Author

@neverCase neverCase Oct 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi, i'm busy now just after the national vocation -,-.
i will update my code latter.

@tao12345666333
Copy link
Member

@neverCase any update?

@neverCase
Copy link
Contributor Author

@tao12345666333 hi, i'm back.

@tao12345666333
Copy link
Member

cool!

@neverCase
Copy link
Contributor Author

@tao12345666333
hi, i have some problems with this pr.
From the ci results above, it shows

Error: pkg/kube/apisix/apis/config/v1alpha1/register.go:42: File is not `gofmt`-ed with `-s` (gofmt)
	scheme.AddKnownTypes(SchemeGroupVersion,
		//&ApisixPluginConfig{},
		//&ApisixPluginConfigList{},
	)
Error: Process completed with exit code 1.

I had annotated the &ApisixPluginConfig{} and &ApisixPluginConfigList{} here, because i hadn't generated the zz_generated.deepcopy.go.
Without a series of deepcopy * functions, these two objects couldn't implement the k8s runtime.Object.
so what should i do next

@tao12345666333
Copy link
Member

Just run make codegen

@neverCase
Copy link
Contributor Author

@tao12345666333 hi, i had run the make codegen and make lint

@neverCase
Copy link
Contributor Author

neverCase commented Nov 19, 2021

  • Add ApisixPluginConfig custom resource. Only need to modify YAML.
  • Add ApisixPluginConfig data structures.
  • Add client implementation to interact with Apache APISIX.
  • Add ApisixPluginConfig translator, it can convert ApisixPluginConfig data structure into APISIX.
  • Add ApisixPluginConfig controller loop, It watches the ApisixPluginConfig resource in the Kubernetes cluster and converts it to the ApisixPluginConfig data structure.
  • Add docs to describe it.

I had add client implementation in the early commit.
Now what i need to do is adding ApisixPluginConfig translator

@neverCase neverCase marked this pull request as ready for review November 22, 2021 07:30
@codecov-commenter
Copy link

codecov-commenter commented Nov 22, 2021

Codecov Report

Merging #694 (e1c0e3f) into master (9f2cd7f) will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #694      +/-   ##
==========================================
- Coverage   32.59%   32.58%   -0.01%     
==========================================
  Files          66       65       -1     
  Lines        6780     6779       -1     
==========================================
- Hits         2210     2209       -1     
  Misses       4321     4321              
  Partials      249      249              
Impacted Files Coverage Δ
test/e2e/e2e.go

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9f2cd7f...e1c0e3f. Read the comment docs.

@neverCase
Copy link
Contributor Author

neverCase commented Nov 22, 2021

I forgot the license header, lol.

@neverCase
Copy link
Contributor Author

@tao12345666333
plz review it once again

Copy link
Member

@tao12345666333 tao12345666333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CRD api-version should be upgrade.

# limitations under the License.
#

apiVersion: apiextensions.k8s.io/v1beta1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have upgraded its version to v1, please upgrade it. #693

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have upgraded its version to v1, please upgrade it. #693
ok

@tao12345666333
Copy link
Member

In #707, we discussed that we want to use a unified version for all resource management, so here could you add it to the v2beta2 version?

I'm sorry that this is inconsistent with our initial expectations.

@neverCase
Copy link
Contributor Author

Never mind.
I will update right now

@neverCase
Copy link
Contributor Author

@tao12345666333
plz review it

pkg/kube/apisix/apis/config/v2beta2/types.go Outdated Show resolved Hide resolved
// ApisixPluginConfigSpec defines the desired state of ApisixPluginConfigSpec.
type ApisixPluginConfigSpec struct {
// +kubebuilder:validation:MinLength=1
Desc string `json:"desc,omitempty" yaml:"desc,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? The Desc for the underlying plugin_config object is used for the management purpose, I think it's not useful for users, they can add descriptions from the annotations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can keep it like this

Is this necessary? The Desc for the underlying plugin_config object is used for the management purpose, I think it's not useful for users, they can add descriptions from the annotations.

I think we can keep it like this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we don't have such field for other objects, and so far no users report such demands, so I doubt the necessity of it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we look at it from the point of view of consistency with other resources, we really don’t need to keep it.

@neverCase could you please remove this field?

samples/deploy/crd/v1/ApisixPluginConfig.yaml Outdated Show resolved Hide resolved
samples/deploy/crd/v1/ApisixPluginConfig.yaml Outdated Show resolved Hide resolved
@neverCase
Copy link
Contributor Author

@tao12345666333
hi, plz review it

@tao12345666333
Copy link
Member

#746 is deleting v1 and v2alpha1, so we don't need to keep these two versions in the CRD definition.

In addition, please fix the lint error. Thanks!

@neverCase
Copy link
Contributor Author

@tao12345666333
I had fixed the lint error about my commits

golangci-lint run
pkg/kube/apisix/apis/config/v2beta2/types.go:211: File is not `gofmt`-ed with `-s` (gofmt)
	Status ApisixStatus  `json:"status,omitempty" yaml:"status,omitempty"`
pkg/apisix/plugin_test.go:25: File is not `goimports`-ed with -local github.com/apache/apisix-ingress-controller (goimports)
	"github.com/apache/apisix-ingress-controller/pkg/metrics"
pkg/apisix/schema_test.go:24: File is not `goimports`-ed with -local github.com/apache/apisix-ingress-controller (goimports)
	"github.com/apache/apisix-ingress-controller/pkg/metrics"

But there were still some errors left:

golangci-lint run
pkg/apisix/plugin_test.go:25: File is not `goimports`-ed with -local github.com/apache/apisix-ingress-controller (goimports)
	"github.com/apache/apisix-ingress-controller/pkg/metrics"
pkg/apisix/schema_test.go:24: File is not `goimports`-ed with -local github.com/apache/apisix-ingress-controller (goimports)
	"github.com/apache/apisix-ingress-controller/pkg/metrics"

Maybe this caused by my latest golangci-lint
golangci-lint has version 1.42.1 built from 54f4301 on 2021-09-04T14:39:09Z
so what could I do to fix it or just ignore it

@tokers
Copy link
Contributor

tokers commented Nov 23, 2021

@tao12345666333 I had fixed the lint error about my commits

golangci-lint run
pkg/kube/apisix/apis/config/v2beta2/types.go:211: File is not `gofmt`-ed with `-s` (gofmt)
	Status ApisixStatus  `json:"status,omitempty" yaml:"status,omitempty"`
pkg/apisix/plugin_test.go:25: File is not `goimports`-ed with -local github.com/apache/apisix-ingress-controller (goimports)
	"github.com/apache/apisix-ingress-controller/pkg/metrics"
pkg/apisix/schema_test.go:24: File is not `goimports`-ed with -local github.com/apache/apisix-ingress-controller (goimports)
	"github.com/apache/apisix-ingress-controller/pkg/metrics"

But there were still some errors left:

golangci-lint run
pkg/apisix/plugin_test.go:25: File is not `goimports`-ed with -local github.com/apache/apisix-ingress-controller (goimports)
	"github.com/apache/apisix-ingress-controller/pkg/metrics"
pkg/apisix/schema_test.go:24: File is not `goimports`-ed with -local github.com/apache/apisix-ingress-controller (goimports)
	"github.com/apache/apisix-ingress-controller/pkg/metrics"

Maybe this caused by my latest golangci-lint golangci-lint has version 1.42.1 built from 54f4301 on 2021-09-04T14:39:09Z so what could I do to fix it or just ignore it

If it's reported by the lint tool, let's fix it.

@neverCase
Copy link
Contributor Author

@tao12345666333 @tokers
Now, what could I do next

@tao12345666333
Copy link
Member

ping @gxthrj

required:
- plugins
properties:
desc:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And remove this one.

@tao12345666333
Copy link
Member

@neverCase There is no problem overall, please delete the desc field and run make codegen again. Then we can merge this PR. Thanks!

@neverCase
Copy link
Contributor Author

neverCase commented Nov 24, 2021

@neverCase There is no problem overall, please delete the desc field and run make codegen again. Then we can merge this PR. Thanks!

@tao12345666333
ok, one minute

@neverCase
Copy link
Contributor Author

neverCase commented Nov 24, 2021

@tao12345666333
hi,i'm ready.

@tao12345666333
Copy link
Member

wait for CI

Copy link
Member

@tao12345666333 tao12345666333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@tao12345666333 tao12345666333 merged commit b127ff4 into apache:master Nov 24, 2021
@neverCase neverCase deleted the feat-638 branch November 25, 2021 02:57
Sindweller pushed a commit to Sindweller/apisix-ingress-controller that referenced this pull request Nov 25, 2021
@tao12345666333 tao12345666333 linked an issue Dec 8, 2021 that may be closed by this pull request
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

proposal: Add CRD ApisixPluginConfig support plugin configs
4 participants