From 4a582338456508dbb2ae07206d802f87d4cae7e7 Mon Sep 17 00:00:00 2001 From: cuisongliu Date: Mon, 2 May 2022 15:48:13 +0800 Subject: [PATCH] feature(main): change gomod sealyun to labring crd (#84) Signed-off-by: cuisongliu --- Makefile | 11 +- README.md | 6 +- api/network/v1beta1/doc.go | 2 +- api/network/v1beta1/register.go | 2 +- api/network/v1beta1/zz_generated.deepcopy.go | 3 +- client/cep.go | 2 +- client/kube.go | 2 +- client/utils.go | 2 +- cmd/cepctl/app/client.go | 2 +- cmd/cepctl/app/options/options.go | 2 +- cmd/cepctl/cepctl.go | 2 +- cmd/endpoints-operator/app/options/options.go | 2 +- cmd/endpoints-operator/app/server.go | 2 +- cmd/endpoints-operator/endpoints-operator.go | 2 +- config/charts/endpoints-operator/Chart.yaml | 2 +- .../crds/sealos.io_clusterendpoints.yaml | 420 +++++++++--------- .../templates/deployment.yaml | 2 +- .../endpoints-operator/templates/rbac.yaml | 2 +- .../endpoints-operator/templates/service.yaml | 2 +- config/charts/endpoints-operator/values.yaml | 8 +- config/crd/sealos.io_clusterendpoints.yaml | 420 +++++++++--------- config/demo/dmz-kube.yaml | 14 +- controllers/controller.go | 2 +- controllers/helper.go | 2 +- controllers/install.go | 2 +- controllers/predicate.go | 2 +- controllers/run_probe.go | 2 +- controllers/sync.go | 6 +- dockerfiles/cepctl/Dockerfile | 2 +- dockerfiles/endpoints-operator/Dockerfile | 2 +- hack/boilerplate.go.txt | 2 +- library/controller/controller.go | 2 +- library/convert/convert.go | 2 +- library/file/file.go | 2 +- library/hash/hash.go | 2 +- library/probe/udp/udp_test.go | 2 +- library/version/version.go | 2 +- metrics/metrics.go | 2 +- metrics/types.go | 2 +- test/concurrent_test.go | 4 +- test/testhelper/kube.go | 2 +- 41 files changed, 478 insertions(+), 478 deletions(-) diff --git a/Makefile b/Makefile index e9170bf..c22bca6 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ filelicense: filelicense: install-addlicense for file in ${Dirs} ; do \ if [[ $$file != '_output' && $$file != 'docs' && $$file != 'vendor' && $$file != 'logger' && $$file != 'applications' ]]; then \ - $(ADDLICENSE_BIN) -y $(shell date +"%Y") -c "The sealyun Authors." -f hack/LICENSE ./$$file ; \ + $(ADDLICENSE_BIN) -y $(shell date +"%Y") -c "The sealos Authors." -f hack/LICENSE ./$$file ; \ fi \ done @@ -68,7 +68,12 @@ deepcopy:install-deepcopy -O zz_generated.deepcopy \ --go-header-file "$(HEAD_FILE)" \ --output-base "${GOPATH}/src" +CONTROLLER_GEN = $(shell pwd)/bin/controller-gen +.PHONY: controller-gen +controller-gen: ## Download controller-gen locally if necessary. + $(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0) # Generate manifests e.g. CRD, RBAC etc. -manifests: - controller-gen crd:trivialVersions=true rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd +manifests: controller-gen + #$(CONTROLLER_GEN) crd:trivialVersions=true rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd + $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd diff --git a/README.md b/README.md index 61a213d..6de8f7f 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ ### 注意事项: -v0.1.1 版本的数据是sealyun.com的domain -v0.1.2 之后所有的domain都是sealos.io +- v0.1.1 版本的数据是sealyun.com的domain +- v0.1.2 之后所有的domain都是sealos.io 也可以手动执行一下脚本,namespace为xxx ```shell @@ -57,7 +57,7 @@ helm install -n kube-system endpoints-operator config/charts/endpoints-operator ## Usage ```yaml -apiVersion: sealos.io/v1beta1 +apiVersion: sealyun.com/v1beta1 kind: ClusterEndpoint metadata: name: wordpress diff --git a/api/network/v1beta1/doc.go b/api/network/v1beta1/doc.go index ea5af5f..97fda36 100644 --- a/api/network/v1beta1/doc.go +++ b/api/network/v1beta1/doc.go @@ -1,4 +1,4 @@ -// Copyright © 2022 The sealyun Authors. +// Copyright © 2022 The sealos Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/api/network/v1beta1/register.go b/api/network/v1beta1/register.go index 994b3c2..435fdd9 100644 --- a/api/network/v1beta1/register.go +++ b/api/network/v1beta1/register.go @@ -1,5 +1,5 @@ /* -Copyright 2022 The sealyun Authors. +Copyright 2022 The sealos Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/api/network/v1beta1/zz_generated.deepcopy.go b/api/network/v1beta1/zz_generated.deepcopy.go index 205c483..e1d6b28 100644 --- a/api/network/v1beta1/zz_generated.deepcopy.go +++ b/api/network/v1beta1/zz_generated.deepcopy.go @@ -1,7 +1,8 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated /* -Copyright 2022 The sealyun Authors. +Copyright 2022 The sealos Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/client/cep.go b/client/cep.go index 8a74d9a..10838cf 100644 --- a/client/cep.go +++ b/client/cep.go @@ -1,4 +1,4 @@ -// Copyright © 2022 The sealyun Authors. +// Copyright © 2022 The sealos Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/client/kube.go b/client/kube.go index 0a85f38..a09d05c 100644 --- a/client/kube.go +++ b/client/kube.go @@ -1,4 +1,4 @@ -// Copyright © 2022 The sealyun Authors. +// Copyright © 2022 The sealos Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/client/utils.go b/client/utils.go index 50e9c19..b861331 100644 --- a/client/utils.go +++ b/client/utils.go @@ -1,4 +1,4 @@ -// Copyright © 2022 The sealyun Authors. +// Copyright © 2022 The sealos Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/cmd/cepctl/app/client.go b/cmd/cepctl/app/client.go index 70b6249..a2e2b01 100644 --- a/cmd/cepctl/app/client.go +++ b/cmd/cepctl/app/client.go @@ -1,5 +1,5 @@ /* -Copyright 2022 The sealyun Authors. +Copyright 2022 The sealos Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/cepctl/app/options/options.go b/cmd/cepctl/app/options/options.go index 1bc4af7..6dab88f 100644 --- a/cmd/cepctl/app/options/options.go +++ b/cmd/cepctl/app/options/options.go @@ -1,4 +1,4 @@ -// Copyright © 2022 The sealyun Authors. +// Copyright © 2022 The sealos Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/cmd/cepctl/cepctl.go b/cmd/cepctl/cepctl.go index a6024be..40f081b 100644 --- a/cmd/cepctl/cepctl.go +++ b/cmd/cepctl/cepctl.go @@ -1,5 +1,5 @@ /* -Copyright 2022 The sealyun Authors. +Copyright 2022 The sealos Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/endpoints-operator/app/options/options.go b/cmd/endpoints-operator/app/options/options.go index 17b40ae..f690f01 100644 --- a/cmd/endpoints-operator/app/options/options.go +++ b/cmd/endpoints-operator/app/options/options.go @@ -1,4 +1,4 @@ -// Copyright © 2022 The sealyun Authors. +// Copyright © 2022 The sealos Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/cmd/endpoints-operator/app/server.go b/cmd/endpoints-operator/app/server.go index c33a7ce..115895e 100644 --- a/cmd/endpoints-operator/app/server.go +++ b/cmd/endpoints-operator/app/server.go @@ -86,7 +86,7 @@ func run(s *options.Options, ctx context.Context) error { mgrOptions = manager.Options{ LeaderElection: s.LeaderElect, LeaderElectionNamespace: "kube-system", - LeaderElectionID: "sealyun-endpoints-operator-leader-election", + LeaderElectionID: "sealos-endpoints-operator-leader-election", LeaderElectionResourceLock: s.LeaderElectionResourceLock, LeaseDuration: &s.LeaderElection.LeaseDuration, RetryPeriod: &s.LeaderElection.RetryPeriod, diff --git a/cmd/endpoints-operator/endpoints-operator.go b/cmd/endpoints-operator/endpoints-operator.go index 2b4bd68..b14a9ef 100644 --- a/cmd/endpoints-operator/endpoints-operator.go +++ b/cmd/endpoints-operator/endpoints-operator.go @@ -1,5 +1,5 @@ /* -Copyright 2022 The sealyun Authors. +Copyright 2022 The sealos Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/config/charts/endpoints-operator/Chart.yaml b/config/charts/endpoints-operator/Chart.yaml index 6ca60bd..ee3e322 100644 --- a/config/charts/endpoints-operator/Chart.yaml +++ b/config/charts/endpoints-operator/Chart.yaml @@ -1,4 +1,4 @@ -# Copyright © 2022 The sealyun Authors. +# Copyright © 2022 The sealos Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/config/charts/endpoints-operator/crds/sealos.io_clusterendpoints.yaml b/config/charts/endpoints-operator/crds/sealos.io_clusterendpoints.yaml index 3ea476d..29a059f 100644 --- a/config/charts/endpoints-operator/crds/sealos.io_clusterendpoints.yaml +++ b/config/charts/endpoints-operator/crds/sealos.io_clusterendpoints.yaml @@ -1,22 +1,12 @@ - --- -apiVersion: apiextensions.k8s.io/v1beta1 +apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.2.5 + controller-gen.kubebuilder.io/version: v0.8.0 creationTimestamp: null name: clusterendpoints.sealos.io spec: - additionalPrinterColumns: - - JSONPath: .metadata.creationTimestamp - description: The creation date - name: Age - type: date - - JSONPath: .status.phase - description: The status - name: Status - type: string group: sealos.io names: kind: ClusterEndpoint @@ -26,207 +16,217 @@ spec: - cep singular: clusterendpoint scope: Namespaced - subresources: - status: {} - validation: - openAPIV3Schema: - description: ClusterEndpoint is the Schema for the tests API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: ClusterEndpointSpec defines the desired state of ClusterEndpoint - properties: - clusterIP: - type: string - hosts: - items: - type: string - type: array - periodSeconds: - description: How often (in seconds) to perform the probe. Default to - 10 seconds. Minimum value is 1. - format: int32 - type: integer - ports: - items: - description: ServicePort contains information on service's port. - properties: - failureThreshold: - description: Minimum consecutive failures for the probe to be - considered failed after having succeeded. Defaults to 3. Minimum - value is 1. - format: int32 - type: integer - grpc: - description: GRPC specifies an action involving a GRPC port. This - is an alpha field and requires enabling GRPCContainerProbe feature - gate. - properties: - enable: - type: boolean - service: - description: "Service is the name of the service to place - in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - \n If this is not specified, the default behavior is defined - by gRPC." - type: string - required: - - enable - type: object - httpGet: - description: HTTPGet specifies the http request to perform. - properties: - httpHeaders: - description: Custom headers to set in the request. HTTP allows - repeated headers. - items: - description: HTTPHeader describes a custom header to be - used in HTTP probes - properties: - name: - description: The header field name - type: string - value: - description: The header field value - type: string - required: - - name - - value - type: object - type: array - path: - description: Path to access on the HTTP server. - type: string - scheme: - description: Scheme to use for connecting to the host. Defaults - to HTTP. - type: string - type: object - name: - description: The name of this port within the service. This must - be a DNS_LABEL. All ports within a ServiceSpec must have unique - names. When considering the endpoints for a Service, this must - match the 'name' field in the EndpointPort. Optional if only - one ServicePort is defined on this service. - type: string - port: - description: The port that will be exposed by this service. - format: int32 - type: integer - protocol: - description: The IP protocol for this port. Supports "TCP", "UDP", - and "SCTP". Default is TCP. - type: string - successThreshold: - description: Minimum consecutive successes for the probe to be - considered successful after having failed. Defaults to 1. Must - be 1 for liveness and startup. Minimum value is 1. - format: int32 - type: integer - targetPort: - description: Number or name of the port to access on the pods - targeted by the service. Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. If this is a string, it will - be looked up as a named port in the target Pod's container ports. - If this is not specified, the value of the 'port' field is used - (an identity map). - format: int32 - type: integer - tcpSocket: - description: TCPSocket specifies an action involving a TCP port. - TCP hooks not yet supported - properties: - enable: - type: boolean - required: - - enable - type: object - timeoutSeconds: - description: 'Number of seconds after which the probe times out. - Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' - format: int32 - type: integer - udpSocket: - description: UDPSocketAction specifies an action involving a UDP - port. UDP hooks not yet supported - properties: - data: - description: UDP test data - items: - type: integer - type: array - enable: - type: boolean - required: - - enable - type: object - required: - - port - - targetPort - type: object - type: array - type: object - status: - description: ClusterEndpointStatus defines the observed state of ClusterEndpoint - properties: - conditions: - description: Conditions contains the different condition statuses for - this workspace. - items: - properties: - lastHeartbeatTime: - description: LastHeartbeatTime is the last time this condition - was updated. - format: date-time - type: string - lastTransitionTime: - description: LastTransitionTime is the last time the condition - changed from one status to another. - format: date-time - type: string - message: - description: Message is a human-readable message indicating details - about the last status change. - type: string - reason: - description: Reason is a (brief) reason for the condition's last - status change. - type: string - status: - description: Status is the status of the condition. One of True, - False, Unknown. - type: string - type: - type: string - required: - - status - - type - type: object - type: array - phase: - description: Phase is the recently observed lifecycle phase of the - cluster endpoints. - type: string - required: - - conditions - type: object - type: object - version: v1beta1 versions: - - name: v1beta1 + - additionalPrinterColumns: + - description: The creation date + jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: The status + jsonPath: .status.phase + name: Status + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: ClusterEndpoint is the Schema for the tests API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: ClusterEndpointSpec defines the desired state of ClusterEndpoint + properties: + clusterIP: + type: string + hosts: + items: + type: string + type: array + periodSeconds: + description: How often (in seconds) to perform the probe. Default + to 10 seconds. Minimum value is 1. + format: int32 + type: integer + ports: + items: + description: ServicePort contains information on service's port. + properties: + failureThreshold: + description: Minimum consecutive failures for the probe to be + considered failed after having succeeded. Defaults to 3. Minimum + value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving a GRPC port. + This is an alpha field and requires enabling GRPCContainerProbe + feature gate. + properties: + enable: + type: boolean + service: + description: "Service is the name of the service to place + in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior is defined + by gRPC." + type: string + required: + - enable + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header to be + used in HTTP probes + properties: + name: + description: The header field name + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + scheme: + description: Scheme to use for connecting to the host. Defaults + to HTTP. + type: string + type: object + name: + description: The name of this port within the service. This + must be a DNS_LABEL. All ports within a ServiceSpec must have + unique names. When considering the endpoints for a Service, + this must match the 'name' field in the EndpointPort. Optional + if only one ServicePort is defined on this service. + type: string + port: + description: The port that will be exposed by this service. + format: int32 + type: integer + protocol: + default: TCP + description: The IP protocol for this port. Supports "TCP", + "UDP", and "SCTP". Default is TCP. + type: string + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed. Defaults to + 1. Must be 1 for liveness and startup. Minimum value is 1. + format: int32 + type: integer + targetPort: + description: Number or name of the port to access on the pods + targeted by the service. Number must be in the range 1 to + 65535. Name must be an IANA_SVC_NAME. If this is a string, + it will be looked up as a named port in the target Pod's container + ports. If this is not specified, the value of the 'port' field + is used (an identity map). + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP port. + TCP hooks not yet supported + properties: + enable: + type: boolean + required: + - enable + type: object + timeoutSeconds: + description: 'Number of seconds after which the probe times + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + udpSocket: + description: UDPSocketAction specifies an action involving a + UDP port. UDP hooks not yet supported + properties: + data: + description: UDP test data + items: + type: integer + type: array + enable: + type: boolean + required: + - enable + type: object + required: + - port + - targetPort + type: object + type: array + type: object + status: + description: ClusterEndpointStatus defines the observed state of ClusterEndpoint + properties: + conditions: + description: Conditions contains the different condition statuses + for this workspace. + items: + properties: + lastHeartbeatTime: + description: LastHeartbeatTime is the last time this condition + was updated. + format: date-time + type: string + lastTransitionTime: + description: LastTransitionTime is the last time the condition + changed from one status to another. + format: date-time + type: string + message: + description: Message is a human-readable message indicating + details about the last status change. + type: string + reason: + description: Reason is a (brief) reason for the condition's + last status change. + type: string + status: + description: Status is the status of the condition. One of True, + False, Unknown. + type: string + type: + type: string + required: + - status + - type + type: object + type: array + phase: + description: Phase is the recently observed lifecycle phase of the + cluster endpoints. + type: string + required: + - conditions + type: object + type: object served: true storage: true + subresources: + status: {} status: acceptedNames: kind: "" diff --git a/config/charts/endpoints-operator/templates/deployment.yaml b/config/charts/endpoints-operator/templates/deployment.yaml index 617bb7a..773e338 100644 --- a/config/charts/endpoints-operator/templates/deployment.yaml +++ b/config/charts/endpoints-operator/templates/deployment.yaml @@ -1,4 +1,4 @@ -# Copyright © 2022 The sealyun Authors. +# Copyright © 2022 The sealos Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/config/charts/endpoints-operator/templates/rbac.yaml b/config/charts/endpoints-operator/templates/rbac.yaml index 5f5e112..d680b1a 100644 --- a/config/charts/endpoints-operator/templates/rbac.yaml +++ b/config/charts/endpoints-operator/templates/rbac.yaml @@ -1,4 +1,4 @@ -# Copyright © 2022 The sealyun Authors. +# Copyright © 2022 The sealos Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/config/charts/endpoints-operator/templates/service.yaml b/config/charts/endpoints-operator/templates/service.yaml index b2af1b8..91bf253 100644 --- a/config/charts/endpoints-operator/templates/service.yaml +++ b/config/charts/endpoints-operator/templates/service.yaml @@ -1,4 +1,4 @@ -# Copyright © 2022 The sealyun Authors. +# Copyright © 2022 The sealos Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/config/charts/endpoints-operator/values.yaml b/config/charts/endpoints-operator/values.yaml index 4932caf..fb4d343 100644 --- a/config/charts/endpoints-operator/values.yaml +++ b/config/charts/endpoints-operator/values.yaml @@ -1,4 +1,4 @@ -# Copyright © 2022 The sealyun Authors. +# Copyright © 2022 The sealos Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ replicaCount: 2 image: - repository: ghcr.io/sealyun + repository: ghcr.io/labring image: endpoints-operator pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. @@ -52,8 +52,8 @@ service: resources: limits: - cpu: 200m - memory: 256Mi + cpu: 500m + memory: 758Mi requests: cpu: 100m memory: 128Mi diff --git a/config/crd/sealos.io_clusterendpoints.yaml b/config/crd/sealos.io_clusterendpoints.yaml index 3ea476d..29a059f 100644 --- a/config/crd/sealos.io_clusterendpoints.yaml +++ b/config/crd/sealos.io_clusterendpoints.yaml @@ -1,22 +1,12 @@ - --- -apiVersion: apiextensions.k8s.io/v1beta1 +apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.2.5 + controller-gen.kubebuilder.io/version: v0.8.0 creationTimestamp: null name: clusterendpoints.sealos.io spec: - additionalPrinterColumns: - - JSONPath: .metadata.creationTimestamp - description: The creation date - name: Age - type: date - - JSONPath: .status.phase - description: The status - name: Status - type: string group: sealos.io names: kind: ClusterEndpoint @@ -26,207 +16,217 @@ spec: - cep singular: clusterendpoint scope: Namespaced - subresources: - status: {} - validation: - openAPIV3Schema: - description: ClusterEndpoint is the Schema for the tests API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: ClusterEndpointSpec defines the desired state of ClusterEndpoint - properties: - clusterIP: - type: string - hosts: - items: - type: string - type: array - periodSeconds: - description: How often (in seconds) to perform the probe. Default to - 10 seconds. Minimum value is 1. - format: int32 - type: integer - ports: - items: - description: ServicePort contains information on service's port. - properties: - failureThreshold: - description: Minimum consecutive failures for the probe to be - considered failed after having succeeded. Defaults to 3. Minimum - value is 1. - format: int32 - type: integer - grpc: - description: GRPC specifies an action involving a GRPC port. This - is an alpha field and requires enabling GRPCContainerProbe feature - gate. - properties: - enable: - type: boolean - service: - description: "Service is the name of the service to place - in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - \n If this is not specified, the default behavior is defined - by gRPC." - type: string - required: - - enable - type: object - httpGet: - description: HTTPGet specifies the http request to perform. - properties: - httpHeaders: - description: Custom headers to set in the request. HTTP allows - repeated headers. - items: - description: HTTPHeader describes a custom header to be - used in HTTP probes - properties: - name: - description: The header field name - type: string - value: - description: The header field value - type: string - required: - - name - - value - type: object - type: array - path: - description: Path to access on the HTTP server. - type: string - scheme: - description: Scheme to use for connecting to the host. Defaults - to HTTP. - type: string - type: object - name: - description: The name of this port within the service. This must - be a DNS_LABEL. All ports within a ServiceSpec must have unique - names. When considering the endpoints for a Service, this must - match the 'name' field in the EndpointPort. Optional if only - one ServicePort is defined on this service. - type: string - port: - description: The port that will be exposed by this service. - format: int32 - type: integer - protocol: - description: The IP protocol for this port. Supports "TCP", "UDP", - and "SCTP". Default is TCP. - type: string - successThreshold: - description: Minimum consecutive successes for the probe to be - considered successful after having failed. Defaults to 1. Must - be 1 for liveness and startup. Minimum value is 1. - format: int32 - type: integer - targetPort: - description: Number or name of the port to access on the pods - targeted by the service. Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. If this is a string, it will - be looked up as a named port in the target Pod's container ports. - If this is not specified, the value of the 'port' field is used - (an identity map). - format: int32 - type: integer - tcpSocket: - description: TCPSocket specifies an action involving a TCP port. - TCP hooks not yet supported - properties: - enable: - type: boolean - required: - - enable - type: object - timeoutSeconds: - description: 'Number of seconds after which the probe times out. - Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' - format: int32 - type: integer - udpSocket: - description: UDPSocketAction specifies an action involving a UDP - port. UDP hooks not yet supported - properties: - data: - description: UDP test data - items: - type: integer - type: array - enable: - type: boolean - required: - - enable - type: object - required: - - port - - targetPort - type: object - type: array - type: object - status: - description: ClusterEndpointStatus defines the observed state of ClusterEndpoint - properties: - conditions: - description: Conditions contains the different condition statuses for - this workspace. - items: - properties: - lastHeartbeatTime: - description: LastHeartbeatTime is the last time this condition - was updated. - format: date-time - type: string - lastTransitionTime: - description: LastTransitionTime is the last time the condition - changed from one status to another. - format: date-time - type: string - message: - description: Message is a human-readable message indicating details - about the last status change. - type: string - reason: - description: Reason is a (brief) reason for the condition's last - status change. - type: string - status: - description: Status is the status of the condition. One of True, - False, Unknown. - type: string - type: - type: string - required: - - status - - type - type: object - type: array - phase: - description: Phase is the recently observed lifecycle phase of the - cluster endpoints. - type: string - required: - - conditions - type: object - type: object - version: v1beta1 versions: - - name: v1beta1 + - additionalPrinterColumns: + - description: The creation date + jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: The status + jsonPath: .status.phase + name: Status + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: ClusterEndpoint is the Schema for the tests API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: ClusterEndpointSpec defines the desired state of ClusterEndpoint + properties: + clusterIP: + type: string + hosts: + items: + type: string + type: array + periodSeconds: + description: How often (in seconds) to perform the probe. Default + to 10 seconds. Minimum value is 1. + format: int32 + type: integer + ports: + items: + description: ServicePort contains information on service's port. + properties: + failureThreshold: + description: Minimum consecutive failures for the probe to be + considered failed after having succeeded. Defaults to 3. Minimum + value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving a GRPC port. + This is an alpha field and requires enabling GRPCContainerProbe + feature gate. + properties: + enable: + type: boolean + service: + description: "Service is the name of the service to place + in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior is defined + by gRPC." + type: string + required: + - enable + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header to be + used in HTTP probes + properties: + name: + description: The header field name + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + scheme: + description: Scheme to use for connecting to the host. Defaults + to HTTP. + type: string + type: object + name: + description: The name of this port within the service. This + must be a DNS_LABEL. All ports within a ServiceSpec must have + unique names. When considering the endpoints for a Service, + this must match the 'name' field in the EndpointPort. Optional + if only one ServicePort is defined on this service. + type: string + port: + description: The port that will be exposed by this service. + format: int32 + type: integer + protocol: + default: TCP + description: The IP protocol for this port. Supports "TCP", + "UDP", and "SCTP". Default is TCP. + type: string + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed. Defaults to + 1. Must be 1 for liveness and startup. Minimum value is 1. + format: int32 + type: integer + targetPort: + description: Number or name of the port to access on the pods + targeted by the service. Number must be in the range 1 to + 65535. Name must be an IANA_SVC_NAME. If this is a string, + it will be looked up as a named port in the target Pod's container + ports. If this is not specified, the value of the 'port' field + is used (an identity map). + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP port. + TCP hooks not yet supported + properties: + enable: + type: boolean + required: + - enable + type: object + timeoutSeconds: + description: 'Number of seconds after which the probe times + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + udpSocket: + description: UDPSocketAction specifies an action involving a + UDP port. UDP hooks not yet supported + properties: + data: + description: UDP test data + items: + type: integer + type: array + enable: + type: boolean + required: + - enable + type: object + required: + - port + - targetPort + type: object + type: array + type: object + status: + description: ClusterEndpointStatus defines the observed state of ClusterEndpoint + properties: + conditions: + description: Conditions contains the different condition statuses + for this workspace. + items: + properties: + lastHeartbeatTime: + description: LastHeartbeatTime is the last time this condition + was updated. + format: date-time + type: string + lastTransitionTime: + description: LastTransitionTime is the last time the condition + changed from one status to another. + format: date-time + type: string + message: + description: Message is a human-readable message indicating + details about the last status change. + type: string + reason: + description: Reason is a (brief) reason for the condition's + last status change. + type: string + status: + description: Status is the status of the condition. One of True, + False, Unknown. + type: string + type: + type: string + required: + - status + - type + type: object + type: array + phase: + description: Phase is the recently observed lifecycle phase of the + cluster endpoints. + type: string + required: + - conditions + type: object + type: object served: true storage: true + subresources: + status: {} status: acceptedNames: kind: "" diff --git a/config/demo/dmz-kube.yaml b/config/demo/dmz-kube.yaml index b5da8e9..a68244c 100644 --- a/config/demo/dmz-kube.yaml +++ b/config/demo/dmz-kube.yaml @@ -1,4 +1,4 @@ -# Copyright © 2022 sealyun. +# Copyright © 2022 sealos. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,11 +17,10 @@ kind: ClusterEndpoint metadata: name: dmz-kube spec: - clusterIP: 10.96.0.100 + clusterIP: None periodSeconds: 10 hosts: - - 10.0.112.255 - - 10.0.112.251 + - 192.168.64.24 ports: - name: https port: 6443 @@ -30,10 +29,3 @@ spec: timeoutSeconds: 1 tcpSocket: enable: true - - name: udp-data - port: 1234 - protocol: UDP - targetPort: 1234 - udpSocket: - enable: true - data: "testdata" diff --git a/controllers/controller.go b/controllers/controller.go index e5480e6..d38656b 100644 --- a/controllers/controller.go +++ b/controllers/controller.go @@ -1,5 +1,5 @@ /* -Copyright 2022 The sealyun Authors. +Copyright 2022 The sealos Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/controllers/helper.go b/controllers/helper.go index 9cb0a66..25dc6b9 100644 --- a/controllers/helper.go +++ b/controllers/helper.go @@ -1,5 +1,5 @@ /* -Copyright 2022 The sealyun Authors. +Copyright 2022 The sealos Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/controllers/install.go b/controllers/install.go index de7bfee..5d68bff 100644 --- a/controllers/install.go +++ b/controllers/install.go @@ -1,5 +1,5 @@ /* -Copyright 2022 The sealyun Authors. +Copyright 2022 The sealos Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/controllers/predicate.go b/controllers/predicate.go index 5e04060..906d31d 100644 --- a/controllers/predicate.go +++ b/controllers/predicate.go @@ -1,4 +1,4 @@ -// Copyright © 2022 sealyun. +// Copyright © 2022 sealos. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/controllers/run_probe.go b/controllers/run_probe.go index 72a7582..a171cf0 100644 --- a/controllers/run_probe.go +++ b/controllers/run_probe.go @@ -1,5 +1,5 @@ /* -Copyright 2022 The sealyun Authors. +Copyright 2022 The sealos Authors. Copyright 2014 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/controllers/sync.go b/controllers/sync.go index de42c5f..039674f 100644 --- a/controllers/sync.go +++ b/controllers/sync.go @@ -1,5 +1,5 @@ /* -Copyright 2022 The sealyun Authors. +Copyright 2022 The sealos Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -53,7 +53,9 @@ func (c *Reconciler) syncService(ctx context.Context, cep *v1beta1.ClusterEndpoi if err := controllerutil.SetControllerReference(cep, svc, c.scheme); err != nil { return err } - // svc.Spec.ClusterIP = cep.Spec.ClusterIP + if cep.Spec.ClusterIP == corev1.ClusterIPNone { + svc.Spec.ClusterIP = corev1.ClusterIPNone + } svc.Spec.Type = corev1.ServiceTypeClusterIP svc.Spec.SessionAffinity = corev1.ServiceAffinityNone svc.Spec.Ports = convertServicePorts(cep.Spec.Ports) diff --git a/dockerfiles/cepctl/Dockerfile b/dockerfiles/cepctl/Dockerfile index a6161a3..fe93404 100644 --- a/dockerfiles/cepctl/Dockerfile +++ b/dockerfiles/cepctl/Dockerfile @@ -1,4 +1,4 @@ -# Copyright © 2022 The sealyun Authors. +# Copyright © 2022 The sealos Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/dockerfiles/endpoints-operator/Dockerfile b/dockerfiles/endpoints-operator/Dockerfile index 41af777..c3f442f 100644 --- a/dockerfiles/endpoints-operator/Dockerfile +++ b/dockerfiles/endpoints-operator/Dockerfile @@ -1,4 +1,4 @@ -# Copyright © 2022 The sealyun Authors. +# Copyright © 2022 The sealos Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/hack/boilerplate.go.txt b/hack/boilerplate.go.txt index bab45a6..afd35fb 100644 --- a/hack/boilerplate.go.txt +++ b/hack/boilerplate.go.txt @@ -1,5 +1,5 @@ /* -Copyright 2022 The sealyun Authors. +Copyright 2022 The sealos Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/controller/controller.go b/library/controller/controller.go index 6c311d5..43108de 100644 --- a/library/controller/controller.go +++ b/library/controller/controller.go @@ -1,4 +1,4 @@ -// Copyright © 2022 The sealyun Authors. +// Copyright © 2022 The sealos Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/library/convert/convert.go b/library/convert/convert.go index 6f577ee..3e6313a 100644 --- a/library/convert/convert.go +++ b/library/convert/convert.go @@ -1,4 +1,4 @@ -// Copyright © 2022 The sealyun Authors. +// Copyright © 2022 The sealos Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/library/file/file.go b/library/file/file.go index 22b1c22..9984379 100644 --- a/library/file/file.go +++ b/library/file/file.go @@ -1,4 +1,4 @@ -// Copyright © 2022 The sealyun Authors. +// Copyright © 2022 The sealos Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/library/hash/hash.go b/library/hash/hash.go index 7a4d66e..d3bd8ff 100644 --- a/library/hash/hash.go +++ b/library/hash/hash.go @@ -1,4 +1,4 @@ -// Copyright © 2022 The sealyun Authors. +// Copyright © 2022 The sealos Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/library/probe/udp/udp_test.go b/library/probe/udp/udp_test.go index a65cf6b..4ad6c09 100644 --- a/library/probe/udp/udp_test.go +++ b/library/probe/udp/udp_test.go @@ -1,4 +1,4 @@ -// Copyright © 2022 The sealyun Authors. +// Copyright © 2022 The sealos Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/library/version/version.go b/library/version/version.go index 0583eb7..b9de81c 100644 --- a/library/version/version.go +++ b/library/version/version.go @@ -1,4 +1,4 @@ -// Copyright © 2022 The sealyun Authors. +// Copyright © 2022 The sealos Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/metrics/metrics.go b/metrics/metrics.go index 2b87391..cd7612f 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -1,4 +1,4 @@ -// Copyright © 2022 The sealyun Authors. +// Copyright © 2022 The sealos Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/metrics/types.go b/metrics/types.go index ba2fc62..d2f776e 100644 --- a/metrics/types.go +++ b/metrics/types.go @@ -1,4 +1,4 @@ -// Copyright © 2022 The sealyun Authors. +// Copyright © 2022 The sealos Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/concurrent_test.go b/test/concurrent_test.go index 0789be9..1c91c0f 100644 --- a/test/concurrent_test.go +++ b/test/concurrent_test.go @@ -25,9 +25,9 @@ import ( func TestAddCrs(t *testing.T) { cep := &v1beta1.ClusterEndpoint{} cep.Namespace = "default" - testhelper.CreateTestCRs(10, "sealyun", cep, t) + testhelper.CreateTestCRs(10, "sealos", cep, t) } func TestDeleteCrs(t *testing.T) { - testhelper.DeleteTestCRs("sealyun", "default", t) + testhelper.DeleteTestCRs("sealos", "default", t) } diff --git a/test/testhelper/kube.go b/test/testhelper/kube.go index ef886b5..a0a92a5 100644 --- a/test/testhelper/kube.go +++ b/test/testhelper/kube.go @@ -1,4 +1,4 @@ -// Copyright © 2022 The sealyun Authors. +// Copyright © 2022 The sealos Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License.