From 323fb31933f93c5aff197499253d7d191120926b Mon Sep 17 00:00:00 2001 From: duanmengkk Date: Fri, 13 Sep 2024 20:09:43 +0800 Subject: [PATCH] add revive linter and fix the lint error Signed-off-by: duanmengkk --- .github/workflows/ci.yml | 4 +- deploy/crds/kosmos.io_knodes.yaml | 127 ------------------ .../kosmos.io_kubenestconfigurations.yaml | 2 +- deploy/crds/kosmos.io_virtualclusters.yaml | 2 +- examples/knode-demo.yaml | 8 -- hack/rune2e.sh | 1 + pkg/generated/openapi/zz_generated.openapi.go | 2 +- pkg/kubenest/controlplane/etcd.go | 12 +- 8 files changed, 11 insertions(+), 147 deletions(-) delete mode 100644 deploy/crds/kosmos.io_knodes.yaml delete mode 100644 examples/knode-demo.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c63a73ec9..d83fa9db9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,8 +9,8 @@ concurrency: jobs: verify: name: verify - runs-on: ubuntu-22.04 -# runs-on: [self-hosted, ecs] +# runs-on: ubuntu-22.04 + runs-on: [self-hosted, ecs] if: ${{ always() }} env: #GOPATH: ${{ github.workspace }} diff --git a/deploy/crds/kosmos.io_knodes.yaml b/deploy/crds/kosmos.io_knodes.yaml deleted file mode 100644 index 647c18313..000000000 --- a/deploy/crds/kosmos.io_knodes.yaml +++ /dev/null @@ -1,127 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.11.0 - creationTimestamp: null - name: knodes.kosmos.io -spec: - group: kosmos.io - names: - kind: Knode - listKind: KnodeList - plural: knodes - singular: knode - scope: Cluster - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - 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: - properties: - disableTaint: - type: boolean - kubeAPIBurst: - default: 100 - type: integer - kubeconfig: - format: byte - type: string - nodeName: - type: string - type: - default: k8s - type: string - type: object - status: - properties: - apiserver: - type: string - conditions: - items: - description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - \n type FooStatus struct{ // Represents the observations of a - foo's current state. // Known .status.conditions.type are: \"Available\", - \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge - // +listType=map // +listMapKey=type Conditions []metav1.Condition - `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" - properties: - lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - version: - type: string - type: object - type: object - served: true - storage: true diff --git a/deploy/crds/kosmos.io_kubenestconfigurations.yaml b/deploy/crds/kosmos.io_kubenestconfigurations.yaml index 40c180383..d1f1c02d3 100644 --- a/deploy/crds/kosmos.io_kubenestconfigurations.yaml +++ b/deploy/crds/kosmos.io_kubenestconfigurations.yaml @@ -77,7 +77,7 @@ spec: type: string type: array type: object - useTenantDns: + useTenantDNS: default: false type: boolean type: object diff --git a/deploy/crds/kosmos.io_virtualclusters.yaml b/deploy/crds/kosmos.io_virtualclusters.yaml index 0d53fad43..9321b6fa6 100644 --- a/deploy/crds/kosmos.io_virtualclusters.yaml +++ b/deploy/crds/kosmos.io_virtualclusters.yaml @@ -95,7 +95,7 @@ spec: type: string type: array type: object - useTenantDns: + useTenantDNS: default: false type: boolean type: object diff --git a/examples/knode-demo.yaml b/examples/knode-demo.yaml deleted file mode 100644 index 45fbacca4..000000000 --- a/examples/knode-demo.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: kosmos.io/v1alpha1 -kind: Knode -metadata: - name: knode-worker1 -spec: - nodeName: knode-worker1 - type: k8s - kubeconfig: {{ .cluster-kubeconfig }} diff --git a/hack/rune2e.sh b/hack/rune2e.sh index 8015ead73..400fd96da 100755 --- a/hack/rune2e.sh +++ b/hack/rune2e.sh @@ -16,6 +16,7 @@ MEMBER3_CLUSTER_NAME="cluster-member3" ROOT="$(dirname "${BASH_SOURCE[0]}")" REPO_ROOT="$(dirname "${BASH_SOURCE[0]}")/.." +source "$(dirname "${BASH_SOURCE[0]}")/install_kind_kubectl.sh" source "${ROOT}/util.sh" source "${ROOT}/cluster.sh" mkdir -p "$ARTIFACTS_PATH" diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index ccedfea20..2479f6fb4 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -1983,7 +1983,7 @@ func schema_pkg_apis_kosmos_v1alpha1_KubeInKubeConfig(ref common.ReferenceCallba Format: "", }, }, - "useTenantDns": { + "useTenantDNS": { SchemaProps: spec.SchemaProps{ Type: []string{"boolean"}, Format: "", diff --git a/pkg/kubenest/controlplane/etcd.go b/pkg/kubenest/controlplane/etcd.go index ab6016647..244f0e50e 100644 --- a/pkg/kubenest/controlplane/etcd.go +++ b/pkg/kubenest/controlplane/etcd.go @@ -30,7 +30,7 @@ func DeleteVirtualClusterEtcd(client clientset.Interface, name, namespace string return nil } -// nolint:revive +// nolint func installEtcd(client clientset.Interface, name, namespace string, kubeNestConfiguration *v1alpha1.KubeNestConfiguration, vc *v1alpha1.VirtualCluster) error { imageRepository, imageVersion := util.GetImageMessage() @@ -52,15 +52,13 @@ func installEtcd(client clientset.Interface, name, namespace string, kubeNestCon namespace, constants.EtcdListenPeerPort, ) - initialClusters[index] = fmt.Sprintf("%s=%s", memberName, memberPeerURL) } - vclabel := util.GetVirtualControllerLabel() - IPV6FirstFlag, err := util.IPV6First(constants.APIServerServiceSubnet) - if err != nil { + vcLabel := util.GetVirtualControllerLabel() + IPV6FirstFlag, newErr := util.IPV6First(constants.APIServerServiceSubnet) + if newErr != nil { return err } - etcdStatefulSetBytes, err := util.ParseTemplate(etcd.EtcdStatefulSet, struct { StatefulSetName, Namespace, ImageRepository, Image, EtcdClientService, Version, VirtualControllerLabel string CertsSecretName, EtcdPeerServiceName string @@ -73,7 +71,7 @@ func installEtcd(client clientset.Interface, name, namespace string, kubeNestCon Namespace: namespace, ImageRepository: imageRepository, Version: imageVersion, - VirtualControllerLabel: vclabel, + VirtualControllerLabel: vcLabel, EtcdClientService: util.GetEtcdClientServerName(name), CertsSecretName: util.GetEtcdCertName(name), EtcdPeerServiceName: util.GetEtcdServerName(name),