From 12d02f281f9ea38f5df96f9de1b20cf9820d9287 Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Thu, 9 Sep 2021 16:16:31 +0700 Subject: [PATCH 01/11] update Flux CRDs Signed-off-by: Chanwit Kaewkasi --- Makefile | 20 +- tools/crd/bucket.yaml | 78 ++----- tools/crd/gitrepository.yaml | 124 +++------- tools/crd/helmrelease.yaml | 416 +++++++++------------------------- tools/crd/helmrepository.yaml | 75 ++---- tools/crd/kustomization.yaml | 237 +++++++------------ 6 files changed, 280 insertions(+), 670 deletions(-) diff --git a/Makefile b/Makefile index 381d240..9178ef9 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: clean all test assets dev proto download-crd-deps -SOURCE_VERSION := v0.13.2 -KUSTOMIZE_VERSION := v0.12.2 -HELM_CRD_VERSION := v0.10.1 +SOURCE_CONTROLLER_VERSION := v0.15.4 +KUSTOMIZE_CONTROLLER_VERSION := v0.14.0 +HELM_CONTROLLER_VERSION := v0.11.2 all: test build @@ -21,8 +21,12 @@ proto: pkg/rpc/clusters/clusters.proto protoc pkg/rpc/clusters/clusters.proto --twirp_out=./ --go_out=. --twirp_typescript_out=./ui/lib/rpc download-crd-deps: - curl -s https://raw.githubusercontent.com/fluxcd/source-controller/${SOURCE_VERSION}/config/crd/bases/source.toolkit.fluxcd.io_gitrepositories.yaml > tools/crd/gitrepository.yaml - curl -s https://raw.githubusercontent.com/fluxcd/source-controller/${SOURCE_VERSION}/config/crd/bases/source.toolkit.fluxcd.io_buckets.yaml > tools/crd/bucket.yaml - curl -s https://raw.githubusercontent.com/fluxcd/kustomize-controller/${KUSTOMIZE_VERSION}/config/crd/bases/kustomize.toolkit.fluxcd.io_kustomizations.yaml > tools/crd/kustomization.yaml - curl -s https://raw.githubusercontent.com/fluxcd/helm-controller/${HELM_CRD_VERSION}/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml > tools/crd/helmrelease.yaml - curl -s https://raw.githubusercontent.com/fluxcd/source-controller/${SOURCE_VERSION}/config/crd/bases/source.toolkit.fluxcd.io_helmrepositories.yaml > tools/crd/helmrepository.yaml + curl -s https://raw.githubusercontent.com/fluxcd/source-controller/${SOURCE_CONTROLLER_VERSION}/config/crd/bases/source.toolkit.fluxcd.io_gitrepositories.yaml > tools/crd/gitrepository.yaml + curl -s https://raw.githubusercontent.com/fluxcd/source-controller/${SOURCE_CONTROLLER_VERSION}/config/crd/bases/source.toolkit.fluxcd.io_buckets.yaml > tools/crd/bucket.yaml + curl -s https://raw.githubusercontent.com/fluxcd/kustomize-controller/${KUSTOMIZE_CONTROLLER_VERSION}/config/crd/bases/kustomize.toolkit.fluxcd.io_kustomizations.yaml > tools/crd/kustomization.yaml + curl -s https://raw.githubusercontent.com/fluxcd/helm-controller/${HELM_CONTROLLER_VERSION}/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml > tools/crd/helmrelease.yaml + curl -s https://raw.githubusercontent.com/fluxcd/source-controller/${SOURCE_CONTROLLER_VERSION}/config/crd/bases/source.toolkit.fluxcd.io_helmrepositories.yaml > tools/crd/helmrepository.yaml + +clean: + rm -rf dist/* || true + rm ./bin/webui || true diff --git a/tools/crd/bucket.yaml b/tools/crd/bucket.yaml index bf923f4..5905c1d 100644 --- a/tools/crd/bucket.yaml +++ b/tools/crd/bucket.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.5.0 creationTimestamp: null name: buckets.source.toolkit.fluxcd.io spec: @@ -35,20 +35,15 @@ spec: description: Bucket is the Schema for the buckets 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' + 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' + 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: BucketSpec defines the desired state of an S3 compatible - bucket + description: BucketSpec defines the desired state of an S3 compatible bucket properties: bucketName: description: The bucket name. @@ -57,10 +52,7 @@ spec: description: The bucket endpoint address. type: string ignore: - description: Ignore overrides the set of excluded patterns in the - .sourceignore format (which is the same as .gitignore). If not provided, - a default will be used, consult the documentation for your version - to find out what those are. + description: Ignore overrides the set of excluded patterns in the .sourceignore format (which is the same as .gitignore). If not provided, a default will be used, consult the documentation for your version to find out what those are. type: string insecure: description: Insecure allows connecting to a non-TLS S3 HTTP endpoint. @@ -79,8 +71,7 @@ spec: description: The bucket region. type: string secretRef: - description: The name of the secret containing authentication credentials - for the Bucket. + description: The name of the secret containing authentication credentials for the Bucket. properties: name: description: Name of the referent @@ -89,8 +80,7 @@ spec: - name type: object suspend: - description: This flag tells the controller to suspend the reconciliation - of this source. + description: This flag tells the controller to suspend the reconciliation of this source. type: boolean timeout: default: 20s @@ -105,24 +95,20 @@ spec: description: BucketStatus defines the observed state of a bucket properties: artifact: - description: Artifact represents the output of the last successful - Bucket sync. + description: Artifact represents the output of the last successful Bucket sync. properties: checksum: description: Checksum is the SHA1 checksum of the artifact. type: string lastUpdateTime: - description: LastUpdateTime is the timestamp corresponding to - the last update of this artifact. + description: LastUpdateTime is the timestamp corresponding to the last update of this artifact. format: date-time type: string path: description: Path is the relative file path of this artifact. type: string revision: - description: Revision is a human readable identifier traceable - in the origin source system. It can be a Git commit SHA, Git - tag, a Helm index timestamp, a Helm chart version, etc. + description: Revision is a human readable identifier traceable in the origin source system. It can be a Git commit SHA, Git tag, a Helm index timestamp, a Helm chart version, etc. type: string url: description: URL is the HTTP address of this artifact. @@ -134,45 +120,23 @@ spec: conditions: description: Conditions holds the conditions for the Bucket. 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, - 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 }" + 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, 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. + 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. + 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. + 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. + 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_])?$ @@ -185,11 +149,7 @@ spec: - 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) + 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 @@ -202,16 +162,14 @@ spec: type: object type: array lastHandledReconcileAt: - description: LastHandledReconcileAt holds the value of the most recent - reconcile request value, so a change can be detected. + description: LastHandledReconcileAt holds the value of the most recent reconcile request value, so a change can be detected. type: string observedGeneration: description: ObservedGeneration is the last observed generation. format: int64 type: integer url: - description: URL is the download link for the artifact output of the - last Bucket sync. + description: URL is the download link for the artifact output of the last Bucket sync. type: string type: object type: object diff --git a/tools/crd/gitrepository.yaml b/tools/crd/gitrepository.yaml index 7e77a6f..dffd859 100644 --- a/tools/crd/gitrepository.yaml +++ b/tools/crd/gitrepository.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.5.0 creationTimestamp: null name: gitrepositories.source.toolkit.fluxcd.io spec: @@ -37,14 +37,10 @@ spec: description: GitRepository is the Schema for the gitrepositories 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' + 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' + 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 @@ -53,27 +49,21 @@ spec: properties: gitImplementation: default: go-git - description: Determines which git client library to use. Defaults - to go-git, valid values are ('go-git', 'libgit2'). + description: Determines which git client library to use. Defaults to go-git, valid values are ('go-git', 'libgit2'). enum: - go-git - libgit2 type: string ignore: - description: Ignore overrides the set of excluded patterns in the - .sourceignore format (which is the same as .gitignore). If not provided, - a default will be used, consult the documentation for your version - to find out what those are. + description: Ignore overrides the set of excluded patterns in the .sourceignore format (which is the same as .gitignore). If not provided, a default will be used, consult the documentation for your version to find out what those are. type: string include: description: Extra git repositories to map into the repository items: - description: GitRepositoryInclude defines a source with a from and - to path. + description: GitRepositoryInclude defines a source with a from and to path. properties: fromPath: - description: The path to copy contents from, defaults to the - root directory. + description: The path to copy contents from, defaults to the root directory. type: string repository: description: Reference to a GitRepository to include. @@ -85,8 +75,7 @@ spec: - name type: object toPath: - description: The path to copy contents to, defaults to the name - of the source ref. + description: The path to copy contents to, defaults to the name of the source ref. type: string required: - repository @@ -96,35 +85,27 @@ spec: description: The interval at which to check for repository updates. type: string recurseSubmodules: - description: When enabled, after the clone is created, initializes - all submodules within, using their default settings. This option - is available only when using the 'go-git' GitImplementation. + description: When enabled, after the clone is created, initializes all submodules within, using their default settings. This option is available only when using the 'go-git' GitImplementation. type: boolean ref: - description: The Git reference to checkout and monitor for changes, - defaults to master branch. + description: The Git reference to checkout and monitor for changes, defaults to master branch. properties: branch: default: master description: The Git branch to checkout, defaults to master. type: string commit: - description: The Git commit SHA to checkout, if specified Tag - filters will be ignored. + description: The Git commit SHA to checkout, if specified Tag filters will be ignored. type: string semver: - description: The Git tag semver expression, takes precedence over - Tag. + description: The Git tag semver expression, takes precedence over Tag. type: string tag: description: The Git tag to checkout, takes precedence over Branch. type: string type: object secretRef: - description: The secret name containing the Git credentials. For HTTPS - repositories the secret must contain username and password fields. - For SSH repositories the secret must contain identity, identity.pub - and known_hosts fields. + description: The secret name containing the Git credentials. For HTTPS repositories the secret must contain username and password fields. For SSH repositories the secret must contain identity, identity.pub and known_hosts fields. properties: name: description: Name of the referent @@ -133,31 +114,26 @@ spec: - name type: object suspend: - description: This flag tells the controller to suspend the reconciliation - of this source. + description: This flag tells the controller to suspend the reconciliation of this source. type: boolean timeout: default: 20s - description: The timeout for remote Git operations like cloning, defaults - to 20s. + description: The timeout for remote Git operations like cloning, defaults to 20s. type: string url: description: The repository URL, can be a HTTP/S or SSH address. pattern: ^(http|https|ssh):// type: string verify: - description: Verify OpenPGP signature for the Git commit HEAD points - to. + description: Verify OpenPGP signature for the Git commit HEAD points to. properties: mode: - description: Mode describes what git object should be verified, - currently ('head'). + description: Mode describes what git object should be verified, currently ('head'). enum: - head type: string secretRef: - description: The secret name containing the public keys of all - trusted Git authors. + description: The secret name containing the public keys of all trusted Git authors. properties: name: description: Name of the referent @@ -176,24 +152,20 @@ spec: description: GitRepositoryStatus defines the observed state of a Git repository. properties: artifact: - description: Artifact represents the output of the last successful - repository sync. + description: Artifact represents the output of the last successful repository sync. properties: checksum: description: Checksum is the SHA1 checksum of the artifact. type: string lastUpdateTime: - description: LastUpdateTime is the timestamp corresponding to - the last update of this artifact. + description: LastUpdateTime is the timestamp corresponding to the last update of this artifact. format: date-time type: string path: description: Path is the relative file path of this artifact. type: string revision: - description: Revision is a human readable identifier traceable - in the origin source system. It can be a Git commit SHA, Git - tag, a Helm index timestamp, a Helm chart version, etc. + description: Revision is a human readable identifier traceable in the origin source system. It can be a Git commit SHA, Git tag, a Helm index timestamp, a Helm chart version, etc. type: string url: description: URL is the HTTP address of this artifact. @@ -205,45 +177,23 @@ spec: conditions: description: Conditions holds the conditions for the GitRepository. 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, - 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 }" + 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, 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. + 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. + 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. + 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. + 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_])?$ @@ -256,11 +206,7 @@ spec: - 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) + 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 @@ -273,8 +219,7 @@ spec: type: object type: array includedArtifacts: - description: IncludedArtifacts represents the included artifacts from - the last successful repository sync. + description: IncludedArtifacts represents the included artifacts from the last successful repository sync. items: description: Artifact represents the output of a source synchronisation. properties: @@ -282,17 +227,14 @@ spec: description: Checksum is the SHA1 checksum of the artifact. type: string lastUpdateTime: - description: LastUpdateTime is the timestamp corresponding to - the last update of this artifact. + description: LastUpdateTime is the timestamp corresponding to the last update of this artifact. format: date-time type: string path: description: Path is the relative file path of this artifact. type: string revision: - description: Revision is a human readable identifier traceable - in the origin source system. It can be a Git commit SHA, Git - tag, a Helm index timestamp, a Helm chart version, etc. + description: Revision is a human readable identifier traceable in the origin source system. It can be a Git commit SHA, Git tag, a Helm index timestamp, a Helm chart version, etc. type: string url: description: URL is the HTTP address of this artifact. @@ -303,16 +245,14 @@ spec: type: object type: array lastHandledReconcileAt: - description: LastHandledReconcileAt holds the value of the most recent - reconcile request value, so a change can be detected. + description: LastHandledReconcileAt holds the value of the most recent reconcile request value, so a change can be detected. type: string observedGeneration: description: ObservedGeneration is the last observed generation. format: int64 type: integer url: - description: URL is the download link for the artifact output of the - last repository sync. + description: URL is the download link for the artifact output of the last repository sync. type: string type: object type: object diff --git a/tools/crd/helmrelease.yaml b/tools/crd/helmrelease.yaml index d43bb44..c25dc27 100644 --- a/tools/crd/helmrelease.yaml +++ b/tools/crd/helmrelease.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.5.0 creationTimestamp: null name: helmreleases.helm.toolkit.fluxcd.io spec: @@ -34,14 +34,10 @@ spec: description: HelmRelease is the Schema for the helmreleases 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' + 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' + 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 @@ -49,24 +45,19 @@ spec: description: HelmReleaseSpec defines the desired state of a Helm release. properties: chart: - description: Chart defines the template of the v1beta1.HelmChart that - should be created for this HelmRelease. + description: Chart defines the template of the v1beta1.HelmChart that should be created for this HelmRelease. properties: spec: - description: Spec holds the template for the v1beta1.HelmChartSpec - for this HelmRelease. + description: Spec holds the template for the v1beta1.HelmChartSpec for this HelmRelease. properties: chart: - description: The name or path the Helm chart is available - at in the SourceRef. + description: The name or path the Helm chart is available at in the SourceRef. type: string interval: - description: Interval at which to check the v1beta1.Source - for updates. Defaults to 'HelmReleaseSpec.Interval'. + description: Interval at which to check the v1beta1.Source for updates. Defaults to 'HelmReleaseSpec.Interval'. type: string sourceRef: - description: The name and namespace of the v1beta1.Source - the chart is available at. + description: The name and namespace of the v1beta1.Source the chart is available at. properties: apiVersion: description: APIVersion of the referent. @@ -92,26 +83,16 @@ spec: - name type: object valuesFile: - description: Alternative values file to use as the default - chart values, expected to be a relative path in the SourceRef. - Deprecated in favor of ValuesFiles, for backwards compatibility - the file defined here is merged before the ValuesFiles items. - Ignored when omitted. + description: Alternative values file to use as the default chart values, expected to be a relative path in the SourceRef. Deprecated in favor of ValuesFiles, for backwards compatibility the file defined here is merged before the ValuesFiles items. Ignored when omitted. type: string valuesFiles: - description: Alternative list of values files to use as the - chart values (values.yaml is not included by default), expected - to be a relative path in the SourceRef. Values files are - merged in the order of this list with the last file overriding - the first. Ignored when omitted. + description: Alternative list of values files to use as the chart values (values.yaml is not included by default), expected to be a relative path in the SourceRef. Values files are merged in the order of this list with the last file overriding the first. Ignored when omitted. items: type: string type: array version: default: '*' - description: Version semver expression, ignored for charts - from v1beta1.GitRepository and v1beta1.Bucket sources. Defaults - to latest when omitted. + description: Version semver expression, ignored for charts from v1beta1.GitRepository and v1beta1.Bucket sources. Defaults to latest when omitted. type: string required: - chart @@ -121,12 +102,9 @@ spec: - spec type: object dependsOn: - description: DependsOn may contain a dependency.CrossNamespaceDependencyReference - slice with references to HelmRelease resources that must be ready - before this HelmRelease can be reconciled. + description: DependsOn may contain a dependency.CrossNamespaceDependencyReference slice with references to HelmRelease resources that must be ready before this HelmRelease can be reconciled. items: - description: CrossNamespaceDependencyReference holds the reference - to a dependency. + description: CrossNamespaceDependencyReference holds the reference to a dependency. properties: name: description: Name holds the name reference of a dependency. @@ -139,100 +117,61 @@ spec: type: object type: array install: - description: Install holds the configuration for Helm install actions - for this HelmRelease. + description: Install holds the configuration for Helm install actions for this HelmRelease. properties: crds: - description: "CRDs upgrade CRDs from the Helm Chart's crds directory - according to the CRD upgrade policy provided here. Valid values - are `Skip`, `Create` or `CreateReplace`. Default is `Create` - and if omitted CRDs are installed but not updated. \n Skip: - do neither install nor replace (update) any CRDs. \n Create: - new CRDs are created, existing CRDs are neither updated nor - deleted. \n CreateReplace: new CRDs are created, existing CRDs - are updated (replaced) but not deleted. \n By default, CRDs - are applied (installed) during Helm install action. With this - option users can opt-in to CRD replace existing CRDs on Helm - install actions, which is not (yet) natively supported by Helm. - https://helm.sh/docs/chart_best_practices/custom_resource_definitions." + description: "CRDs upgrade CRDs from the Helm Chart's crds directory according to the CRD upgrade policy provided here. Valid values are `Skip`, `Create` or `CreateReplace`. Default is `Create` and if omitted CRDs are installed but not updated. \n Skip: do neither install nor replace (update) any CRDs. \n Create: new CRDs are created, existing CRDs are neither updated nor deleted. \n CreateReplace: new CRDs are created, existing CRDs are updated (replaced) but not deleted. \n By default, CRDs are applied (installed) during Helm install action. With this option users can opt-in to CRD replace existing CRDs on Helm install actions, which is not (yet) natively supported by Helm. https://helm.sh/docs/chart_best_practices/custom_resource_definitions." enum: - Skip - Create - CreateReplace type: string createNamespace: - description: CreateNamespace tells the Helm install action to - create the HelmReleaseSpec.TargetNamespace if it does not exist - yet. On uninstall, the namespace will not be garbage collected. + description: CreateNamespace tells the Helm install action to create the HelmReleaseSpec.TargetNamespace if it does not exist yet. On uninstall, the namespace will not be garbage collected. type: boolean disableHooks: - description: DisableHooks prevents hooks from running during the - Helm install action. + description: DisableHooks prevents hooks from running during the Helm install action. type: boolean disableOpenAPIValidation: - description: DisableOpenAPIValidation prevents the Helm install - action from validating rendered templates against the Kubernetes - OpenAPI Schema. + description: DisableOpenAPIValidation prevents the Helm install action from validating rendered templates against the Kubernetes OpenAPI Schema. type: boolean disableWait: - description: DisableWait disables the waiting for resources to - be ready after a Helm install has been performed. + description: DisableWait disables the waiting for resources to be ready after a Helm install has been performed. + type: boolean + disableWaitForJobs: + description: DisableWaitForJobs disables waiting for jobs to complete after a Helm install has been performed. type: boolean remediation: - description: Remediation holds the remediation configuration for - when the Helm install action for the HelmRelease fails. The - default is to not perform any action. + description: Remediation holds the remediation configuration for when the Helm install action for the HelmRelease fails. The default is to not perform any action. properties: ignoreTestFailures: - description: IgnoreTestFailures tells the controller to skip - remediation when the Helm tests are run after an install - action but fail. Defaults to 'Test.IgnoreFailures'. + description: IgnoreTestFailures tells the controller to skip remediation when the Helm tests are run after an install action but fail. Defaults to 'Test.IgnoreFailures'. type: boolean remediateLastFailure: - description: RemediateLastFailure tells the controller to - remediate the last failure, when no retries remain. Defaults - to 'false'. + description: RemediateLastFailure tells the controller to remediate the last failure, when no retries remain. Defaults to 'false'. type: boolean retries: - description: Retries is the number of retries that should - be attempted on failures before bailing. Remediation, using - an uninstall, is performed between each attempt. Defaults - to '0', a negative integer equals to unlimited retries. + description: Retries is the number of retries that should be attempted on failures before bailing. Remediation, using an uninstall, is performed between each attempt. Defaults to '0', a negative integer equals to unlimited retries. type: integer type: object replace: - description: Replace tells the Helm install action to re-use the - 'ReleaseName', but only if that name is a deleted release which - remains in the history. + description: Replace tells the Helm install action to re-use the 'ReleaseName', but only if that name is a deleted release which remains in the history. type: boolean skipCRDs: - description: "SkipCRDs tells the Helm install action to not install - any CRDs. By default, CRDs are installed if not already present. - \n Deprecated use CRD policy (`crds`) attribute with value `Skip` - instead." + description: "SkipCRDs tells the Helm install action to not install any CRDs. By default, CRDs are installed if not already present. \n Deprecated use CRD policy (`crds`) attribute with value `Skip` instead." type: boolean timeout: - description: Timeout is the time to wait for any individual Kubernetes - operation (like Jobs for hooks) during the performance of a - Helm install action. Defaults to 'HelmReleaseSpec.Timeout'. + description: Timeout is the time to wait for any individual Kubernetes operation (like Jobs for hooks) during the performance of a Helm install action. Defaults to 'HelmReleaseSpec.Timeout'. type: string type: object interval: description: Interval at which to reconcile the Helm release. type: string kubeConfig: - description: KubeConfig for reconciling the HelmRelease on a remote - cluster. When specified, KubeConfig takes precedence over ServiceAccountName. + description: KubeConfig for reconciling the HelmRelease on a remote cluster. When specified, KubeConfig takes precedence over ServiceAccountName. properties: secretRef: - description: SecretRef holds the name to a secret that contains - a 'value' key with the kubeconfig file as the value. It must - be in the same namespace as the HelmRelease. It is recommended - that the kubeconfig is self-contained, and the secret is regularly - updated if credentials such as a cloud-access-token expire. - Cloud specific `cmd-path` auth helpers will not function without - adding binaries and credentials to the Pod that is responsible - for reconciling the HelmRelease. + description: SecretRef holds the name to a secret that contains a 'value' key with the kubeconfig file as the value. It must be in the same namespace as the HelmRelease. It is recommended that the kubeconfig is self-contained, and the secret is regularly updated if credentials such as a cloud-access-token expire. Cloud specific `cmd-path` auth helpers will not function without adding binaries and credentials to the Pod that is responsible for reconciling the HelmRelease. properties: name: description: Name of the referent @@ -242,13 +181,10 @@ spec: type: object type: object maxHistory: - description: MaxHistory is the number of revisions saved by Helm for - this HelmRelease. Use '0' for an unlimited number of revisions; - defaults to '10'. + description: MaxHistory is the number of revisions saved by Helm for this HelmRelease. Use '0' for an unlimited number of revisions; defaults to '10'. type: integer postRenderers: - description: PostRenderers holds an array of Helm PostRenderers, which - will be applied in order of their definition. + description: PostRenderers holds an array of Helm PostRenderers, which will be applied in order of their definition. items: description: PostRenderer contains a Helm PostRenderer specification. properties: @@ -256,30 +192,21 @@ spec: description: Kustomization to apply as PostRenderer. properties: images: - description: Images is a list of (image name, new name, - new tag or digest) for changing image names, tags or digests. - This can also be achieved with a patch, but this operator - is simpler to specify. + description: Images is a list of (image name, new name, new tag or digest) for changing image names, tags or digests. This can also be achieved with a patch, but this operator is simpler to specify. items: - description: Image contains an image name, a new name, - a new tag or digest, which will replace the original - name and tag. + description: Image contains an image name, a new name, a new tag or digest, which will replace the original name and tag. properties: digest: - description: Digest is the value used to replace the - original image tag. If digest is present NewTag - value is ignored. + description: Digest is the value used to replace the original image tag. If digest is present NewTag value is ignored. type: string name: description: Name is a tag-less image name. type: string newName: - description: NewName is the value used to replace - the original name. + description: NewName is the value used to replace the original name. type: string newTag: - description: NewTag is the value used to replace the - original tag. + description: NewTag is the value used to replace the original tag. type: string required: - name @@ -288,15 +215,12 @@ spec: patchesJson6902: description: JSON 6902 patches, defined as inline YAML objects. items: - description: JSON6902Patch contains a JSON6902 patch and - the target the patch should be applied to. + description: JSON6902Patch contains a JSON6902 patch and the target the patch should be applied to. properties: patch: - description: Patch contains the JSON6902 patch document - with an array of operation objects. + description: Patch contains the JSON6902 patch document with an array of operation objects. items: - description: JSON6902 is a JSON6902 operation object. - https://tools.ietf.org/html/rfc6902#section-4 + description: JSON6902 is a JSON6902 operation object. https://tools.ietf.org/html/rfc6902#section-4 properties: from: type: string @@ -319,30 +243,19 @@ spec: type: object type: array target: - description: Target points to the resources that the - patch document should be applied to. + description: Target points to the resources that the patch document should be applied to. properties: annotationSelector: - description: AnnotationSelector is a string that - follows the label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api - It matches with the resource annotations. + description: AnnotationSelector is a string that follows the label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api It matches with the resource annotations. type: string group: - description: Group is the API group to select - resources from. Together with Version and Kind - it is capable of unambiguously identifying and/or - selecting resources. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md + description: Group is the API group to select resources from. Together with Version and Kind it is capable of unambiguously identifying and/or selecting resources. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md type: string kind: - description: Kind of the API Group to select resources - from. Together with Group and Version it is - capable of unambiguously identifying and/or - selecting resources. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md + description: Kind of the API Group to select resources from. Together with Group and Version it is capable of unambiguously identifying and/or selecting resources. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md type: string labelSelector: - description: LabelSelector is a string that follows - the label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api - It matches with the resource labels. + description: LabelSelector is a string that follows the label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api It matches with the resource labels. type: string name: description: Name to match resources with. @@ -351,10 +264,7 @@ spec: description: Namespace to select resources from. type: string version: - description: Version of the API Group to select - resources from. Together with Group and Kind - it is capable of unambiguously identifying and/or - selecting resources. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md + description: Version of the API Group to select resources from. Together with Group and Kind it is capable of unambiguously identifying and/or selecting resources. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md type: string type: object required: @@ -363,8 +273,7 @@ spec: type: object type: array patchesStrategicMerge: - description: Strategic merge patches, defined as inline - YAML objects. + description: Strategic merge patches, defined as inline YAML objects. items: x-kubernetes-preserve-unknown-fields: true type: array @@ -372,227 +281,161 @@ spec: type: object type: array releaseName: - description: ReleaseName used for the Helm release. Defaults to a - composition of '[TargetNamespace-]Name'. + description: ReleaseName used for the Helm release. Defaults to a composition of '[TargetNamespace-]Name'. maxLength: 53 minLength: 1 type: string rollback: - description: Rollback holds the configuration for Helm rollback actions - for this HelmRelease. + description: Rollback holds the configuration for Helm rollback actions for this HelmRelease. properties: cleanupOnFail: - description: CleanupOnFail allows deletion of new resources created - during the Helm rollback action when it fails. + description: CleanupOnFail allows deletion of new resources created during the Helm rollback action when it fails. type: boolean disableHooks: - description: DisableHooks prevents hooks from running during the - Helm rollback action. + description: DisableHooks prevents hooks from running during the Helm rollback action. type: boolean disableWait: - description: DisableWait disables the waiting for resources to - be ready after a Helm rollback has been performed. + description: DisableWait disables the waiting for resources to be ready after a Helm rollback has been performed. + type: boolean + disableWaitForJobs: + description: DisableWaitForJobs disables waiting for jobs to complete after a Helm rollback has been performed. type: boolean force: - description: Force forces resource updates through a replacement - strategy. + description: Force forces resource updates through a replacement strategy. type: boolean recreate: - description: Recreate performs pod restarts for the resource if - applicable. + description: Recreate performs pod restarts for the resource if applicable. type: boolean timeout: - description: Timeout is the time to wait for any individual Kubernetes - operation (like Jobs for hooks) during the performance of a - Helm rollback action. Defaults to 'HelmReleaseSpec.Timeout'. + description: Timeout is the time to wait for any individual Kubernetes operation (like Jobs for hooks) during the performance of a Helm rollback action. Defaults to 'HelmReleaseSpec.Timeout'. type: string type: object serviceAccountName: - description: The name of the Kubernetes service account to impersonate - when reconciling this HelmRelease. + description: The name of the Kubernetes service account to impersonate when reconciling this HelmRelease. type: string storageNamespace: - description: StorageNamespace used for the Helm storage. Defaults - to the namespace of the HelmRelease. + description: StorageNamespace used for the Helm storage. Defaults to the namespace of the HelmRelease. maxLength: 63 minLength: 1 type: string suspend: - description: Suspend tells the controller to suspend reconciliation - for this HelmRelease, it does not apply to already started reconciliations. - Defaults to false. + description: Suspend tells the controller to suspend reconciliation for this HelmRelease, it does not apply to already started reconciliations. Defaults to false. type: boolean targetNamespace: - description: TargetNamespace to target when performing operations - for the HelmRelease. Defaults to the namespace of the HelmRelease. + description: TargetNamespace to target when performing operations for the HelmRelease. Defaults to the namespace of the HelmRelease. maxLength: 63 minLength: 1 type: string test: - description: Test holds the configuration for Helm test actions for - this HelmRelease. + description: Test holds the configuration for Helm test actions for this HelmRelease. properties: enable: - description: Enable enables Helm test actions for this HelmRelease - after an Helm install or upgrade action has been performed. + description: Enable enables Helm test actions for this HelmRelease after an Helm install or upgrade action has been performed. type: boolean ignoreFailures: - description: IgnoreFailures tells the controller to skip remediation - when the Helm tests are run but fail. Can be overwritten for - tests run after install or upgrade actions in 'Install.IgnoreTestFailures' - and 'Upgrade.IgnoreTestFailures'. + description: IgnoreFailures tells the controller to skip remediation when the Helm tests are run but fail. Can be overwritten for tests run after install or upgrade actions in 'Install.IgnoreTestFailures' and 'Upgrade.IgnoreTestFailures'. type: boolean timeout: - description: Timeout is the time to wait for any individual Kubernetes - operation during the performance of a Helm test action. Defaults - to 'HelmReleaseSpec.Timeout'. + description: Timeout is the time to wait for any individual Kubernetes operation during the performance of a Helm test action. Defaults to 'HelmReleaseSpec.Timeout'. type: string type: object timeout: - description: Timeout is the time to wait for any individual Kubernetes - operation (like Jobs for hooks) during the performance of a Helm - action. Defaults to '5m0s'. + description: Timeout is the time to wait for any individual Kubernetes operation (like Jobs for hooks) during the performance of a Helm action. Defaults to '5m0s'. type: string uninstall: - description: Uninstall holds the configuration for Helm uninstall - actions for this HelmRelease. + description: Uninstall holds the configuration for Helm uninstall actions for this HelmRelease. properties: disableHooks: - description: DisableHooks prevents hooks from running during the - Helm rollback action. + description: DisableHooks prevents hooks from running during the Helm rollback action. type: boolean keepHistory: - description: KeepHistory tells Helm to remove all associated resources - and mark the release as deleted, but retain the release history. + description: KeepHistory tells Helm to remove all associated resources and mark the release as deleted, but retain the release history. type: boolean timeout: - description: Timeout is the time to wait for any individual Kubernetes - operation (like Jobs for hooks) during the performance of a - Helm uninstall action. Defaults to 'HelmReleaseSpec.Timeout'. + description: Timeout is the time to wait for any individual Kubernetes operation (like Jobs for hooks) during the performance of a Helm uninstall action. Defaults to 'HelmReleaseSpec.Timeout'. type: string type: object upgrade: - description: Upgrade holds the configuration for Helm upgrade actions - for this HelmRelease. + description: Upgrade holds the configuration for Helm upgrade actions for this HelmRelease. properties: cleanupOnFail: - description: CleanupOnFail allows deletion of new resources created - during the Helm upgrade action when it fails. + description: CleanupOnFail allows deletion of new resources created during the Helm upgrade action when it fails. type: boolean crds: - description: "CRDs upgrade CRDs from the Helm Chart's crds directory - according to the CRD upgrade policy provided here. Valid values - are `Skip`, `Create` or `CreateReplace`. Default is `Skip` and - if omitted CRDs are neither installed nor upgraded. \n Skip: - do neither install nor replace (update) any CRDs. \n Create: - new CRDs are created, existing CRDs are neither updated nor - deleted. \n CreateReplace: new CRDs are created, existing CRDs - are updated (replaced) but not deleted. \n By default, CRDs - are not applied during Helm upgrade action. With this option - users can opt-in to CRD upgrade, which is not (yet) natively - supported by Helm. https://helm.sh/docs/chart_best_practices/custom_resource_definitions." + description: "CRDs upgrade CRDs from the Helm Chart's crds directory according to the CRD upgrade policy provided here. Valid values are `Skip`, `Create` or `CreateReplace`. Default is `Skip` and if omitted CRDs are neither installed nor upgraded. \n Skip: do neither install nor replace (update) any CRDs. \n Create: new CRDs are created, existing CRDs are neither updated nor deleted. \n CreateReplace: new CRDs are created, existing CRDs are updated (replaced) but not deleted. \n By default, CRDs are not applied during Helm upgrade action. With this option users can opt-in to CRD upgrade, which is not (yet) natively supported by Helm. https://helm.sh/docs/chart_best_practices/custom_resource_definitions." enum: - Skip - Create - CreateReplace type: string disableHooks: - description: DisableHooks prevents hooks from running during the - Helm upgrade action. + description: DisableHooks prevents hooks from running during the Helm upgrade action. type: boolean disableOpenAPIValidation: - description: DisableOpenAPIValidation prevents the Helm upgrade - action from validating rendered templates against the Kubernetes - OpenAPI Schema. + description: DisableOpenAPIValidation prevents the Helm upgrade action from validating rendered templates against the Kubernetes OpenAPI Schema. type: boolean disableWait: - description: DisableWait disables the waiting for resources to - be ready after a Helm upgrade has been performed. + description: DisableWait disables the waiting for resources to be ready after a Helm upgrade has been performed. + type: boolean + disableWaitForJobs: + description: DisableWaitForJobs disables waiting for jobs to complete after a Helm upgrade has been performed. type: boolean force: - description: Force forces resource updates through a replacement - strategy. + description: Force forces resource updates through a replacement strategy. type: boolean preserveValues: - description: PreserveValues will make Helm reuse the last release's - values and merge in overrides from 'Values'. Setting this flag - makes the HelmRelease non-declarative. + description: PreserveValues will make Helm reuse the last release's values and merge in overrides from 'Values'. Setting this flag makes the HelmRelease non-declarative. type: boolean remediation: - description: Remediation holds the remediation configuration for - when the Helm upgrade action for the HelmRelease fails. The - default is to not perform any action. + description: Remediation holds the remediation configuration for when the Helm upgrade action for the HelmRelease fails. The default is to not perform any action. properties: ignoreTestFailures: - description: IgnoreTestFailures tells the controller to skip - remediation when the Helm tests are run after an upgrade - action but fail. Defaults to 'Test.IgnoreFailures'. + description: IgnoreTestFailures tells the controller to skip remediation when the Helm tests are run after an upgrade action but fail. Defaults to 'Test.IgnoreFailures'. type: boolean remediateLastFailure: - description: RemediateLastFailure tells the controller to - remediate the last failure, when no retries remain. Defaults - to 'false' unless 'Retries' is greater than 0. + description: RemediateLastFailure tells the controller to remediate the last failure, when no retries remain. Defaults to 'false' unless 'Retries' is greater than 0. type: boolean retries: - description: Retries is the number of retries that should - be attempted on failures before bailing. Remediation, using - 'Strategy', is performed between each attempt. Defaults - to '0', a negative integer equals to unlimited retries. + description: Retries is the number of retries that should be attempted on failures before bailing. Remediation, using 'Strategy', is performed between each attempt. Defaults to '0', a negative integer equals to unlimited retries. type: integer strategy: - description: Strategy to use for failure remediation. Defaults - to 'rollback'. + description: Strategy to use for failure remediation. Defaults to 'rollback'. enum: - rollback - uninstall type: string type: object timeout: - description: Timeout is the time to wait for any individual Kubernetes - operation (like Jobs for hooks) during the performance of a - Helm upgrade action. Defaults to 'HelmReleaseSpec.Timeout'. + description: Timeout is the time to wait for any individual Kubernetes operation (like Jobs for hooks) during the performance of a Helm upgrade action. Defaults to 'HelmReleaseSpec.Timeout'. type: string type: object values: description: Values holds the values for this Helm release. x-kubernetes-preserve-unknown-fields: true valuesFrom: - description: ValuesFrom holds references to resources containing Helm - values for this HelmRelease, and information about how they should - be merged. + description: ValuesFrom holds references to resources containing Helm values for this HelmRelease, and information about how they should be merged. items: - description: ValuesReference contains a reference to a resource - containing Helm values, and optionally the key they can be found - at. + description: ValuesReference contains a reference to a resource containing Helm values, and optionally the key they can be found at. properties: kind: - description: Kind of the values referent, valid values are ('Secret', - 'ConfigMap'). + description: Kind of the values referent, valid values are ('Secret', 'ConfigMap'). enum: - Secret - ConfigMap type: string name: - description: Name of the values referent. Should reside in the - same namespace as the referring resource. + description: Name of the values referent. Should reside in the same namespace as the referring resource. maxLength: 253 minLength: 1 type: string optional: - description: Optional marks this ValuesReference as optional. - When set, a not found error for the values reference is ignored, - but any ValuesKey, TargetPath or transient error will still - result in a reconciliation failure. + description: Optional marks this ValuesReference as optional. When set, a not found error for the values reference is ignored, but any ValuesKey, TargetPath or transient error will still result in a reconciliation failure. type: boolean targetPath: - description: TargetPath is the YAML dot notation path the value - should be merged at. When set, the ValuesKey is expected to - be a single flat value. Defaults to 'None', which results - in the values getting merged at the root. + description: TargetPath is the YAML dot notation path the value should be merged at. When set, the ValuesKey is expected to be a single flat value. Defaults to 'None', which results in the values getting merged at the root. type: string valuesKey: - description: ValuesKey is the data key where the values.yaml - or a specific value can be found at. Defaults to 'values.yaml'. + description: ValuesKey is the data key where the values.yaml or a specific value can be found at. Defaults to 'values.yaml'. type: string required: - kind @@ -604,50 +447,30 @@ spec: - interval type: object status: + default: + observedGeneration: -1 description: HelmReleaseStatus defines the observed state of a HelmRelease. properties: conditions: description: Conditions holds the conditions for the HelmRelease. 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, - 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 }" + 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, 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. + 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. + 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. + 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. + 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_])?$ @@ -660,11 +483,7 @@ spec: - 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) + 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 @@ -677,46 +496,37 @@ spec: type: object type: array failures: - description: Failures is the reconciliation failure count against - the latest desired state. It is reset after a successful reconciliation. + description: Failures is the reconciliation failure count against the latest desired state. It is reset after a successful reconciliation. format: int64 type: integer helmChart: - description: HelmChart is the namespaced name of the HelmChart resource - created by the controller for the HelmRelease. + description: HelmChart is the namespaced name of the HelmChart resource created by the controller for the HelmRelease. type: string installFailures: - description: InstallFailures is the install failure count against - the latest desired state. It is reset after a successful reconciliation. + description: InstallFailures is the install failure count against the latest desired state. It is reset after a successful reconciliation. format: int64 type: integer lastAppliedRevision: - description: LastAppliedRevision is the revision of the last successfully - applied source. + description: LastAppliedRevision is the revision of the last successfully applied source. type: string lastAttemptedRevision: - description: LastAttemptedRevision is the revision of the last reconciliation - attempt. + description: LastAttemptedRevision is the revision of the last reconciliation attempt. type: string lastAttemptedValuesChecksum: - description: LastAttemptedValuesChecksum is the SHA1 checksum of the - values of the last reconciliation attempt. + description: LastAttemptedValuesChecksum is the SHA1 checksum of the values of the last reconciliation attempt. type: string lastHandledReconcileAt: - description: LastHandledReconcileAt holds the value of the most recent - reconcile request value, so a change can be detected. + description: LastHandledReconcileAt holds the value of the most recent reconcile request value, so a change can be detected. type: string lastReleaseRevision: - description: LastReleaseRevision is the revision of the last successful - Helm release. + description: LastReleaseRevision is the revision of the last successful Helm release. type: integer observedGeneration: description: ObservedGeneration is the last observed generation. format: int64 type: integer upgradeFailures: - description: UpgradeFailures is the upgrade failure count against - the latest desired state. It is reset after a successful reconciliation. + description: UpgradeFailures is the upgrade failure count against the latest desired state. It is reset after a successful reconciliation. format: int64 type: integer type: object diff --git a/tools/crd/helmrepository.yaml b/tools/crd/helmrepository.yaml index 2f9296c..4409c0f 100644 --- a/tools/crd/helmrepository.yaml +++ b/tools/crd/helmrepository.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.5.0 creationTimestamp: null name: helmrepositories.source.toolkit.fluxcd.io spec: @@ -37,14 +37,10 @@ spec: description: HelmRepository is the Schema for the helmrepositories 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' + 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' + 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 @@ -54,11 +50,11 @@ spec: interval: description: The interval at which to check the upstream for updates. type: string + passCredentials: + description: PassCredentials allows the credentials from the SecretRef to be passed on to a host that does not match the host as defined in URL. This may be required if the host of the advertised chart URLs in the index differ from the defined URL. Enabling this should be done with caution, as it can potentially result in credentials getting stolen in a MITM-attack. + type: boolean secretRef: - description: The name of the secret containing authentication credentials - for the Helm repository. For HTTP/S basic auth the secret must contain - username and password fields. For TLS the secret must contain a - certFile and keyFile, and/or caCert fields. + description: The name of the secret containing authentication credentials for the Helm repository. For HTTP/S basic auth the secret must contain username and password fields. For TLS the secret must contain a certFile and keyFile, and/or caCert fields. properties: name: description: Name of the referent @@ -67,16 +63,14 @@ spec: - name type: object suspend: - description: This flag tells the controller to suspend the reconciliation - of this source. + description: This flag tells the controller to suspend the reconciliation of this source. type: boolean timeout: default: 60s description: The timeout of index downloading, defaults to 60s. type: string url: - description: The Helm repository URL, a valid URL contains at least - a protocol and host. + description: The Helm repository URL, a valid URL contains at least a protocol and host. type: string required: - interval @@ -86,24 +80,20 @@ spec: description: HelmRepositoryStatus defines the observed state of the HelmRepository. properties: artifact: - description: Artifact represents the output of the last successful - repository sync. + description: Artifact represents the output of the last successful repository sync. properties: checksum: description: Checksum is the SHA1 checksum of the artifact. type: string lastUpdateTime: - description: LastUpdateTime is the timestamp corresponding to - the last update of this artifact. + description: LastUpdateTime is the timestamp corresponding to the last update of this artifact. format: date-time type: string path: description: Path is the relative file path of this artifact. type: string revision: - description: Revision is a human readable identifier traceable - in the origin source system. It can be a Git commit SHA, Git - tag, a Helm index timestamp, a Helm chart version, etc. + description: Revision is a human readable identifier traceable in the origin source system. It can be a Git commit SHA, Git tag, a Helm index timestamp, a Helm chart version, etc. type: string url: description: URL is the HTTP address of this artifact. @@ -115,45 +105,23 @@ spec: conditions: description: Conditions holds the conditions for the HelmRepository. 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, - 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 }" + 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, 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. + 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. + 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. + 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. + 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_])?$ @@ -166,11 +134,7 @@ spec: - 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) + 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 @@ -183,8 +147,7 @@ spec: type: object type: array lastHandledReconcileAt: - description: LastHandledReconcileAt holds the value of the most recent - reconcile request value, so a change can be detected. + description: LastHandledReconcileAt holds the value of the most recent reconcile request value, so a change can be detected. type: string observedGeneration: description: ObservedGeneration is the last observed generation. diff --git a/tools/crd/kustomization.yaml b/tools/crd/kustomization.yaml index ce2614a..9ae59c7 100644 --- a/tools/crd/kustomization.yaml +++ b/tools/crd/kustomization.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.5.0 creationTimestamp: null name: kustomizations.kustomize.toolkit.fluxcd.io spec: @@ -34,14 +34,10 @@ spec: description: Kustomization is the Schema for the kustomizations 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' + 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' + 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 @@ -49,8 +45,7 @@ spec: description: KustomizationSpec defines the desired state of a kustomization. properties: decryption: - description: Decrypt Kubernetes secrets before applying them on the - cluster. + description: Decrypt Kubernetes secrets before applying them on the cluster. properties: provider: description: Provider is the name of the decryption engine. @@ -58,8 +53,7 @@ spec: - sops type: string secretRef: - description: The secret name containing the private OpenPGP keys - used for decryption. + description: The secret name containing the private OpenPGP keys used for decryption. properties: name: description: Name of the referent @@ -71,12 +65,9 @@ spec: - provider type: object dependsOn: - description: DependsOn may contain a dependency.CrossNamespaceDependencyReference - slice with references to Kustomization resources that must be ready - before this Kustomization can be reconciled. + description: DependsOn may contain a dependency.CrossNamespaceDependencyReference slice with references to Kustomization resources that must be ready before this Kustomization can be reconciled. items: - description: CrossNamespaceDependencyReference holds the reference - to a dependency. + description: CrossNamespaceDependencyReference holds the reference to a dependency. properties: name: description: Name holds the name reference of a dependency. @@ -90,18 +81,15 @@ spec: type: array force: default: false - description: Force instructs the controller to recreate resources - when patching fails due to an immutable field change. + description: Force instructs the controller to recreate resources when patching fails due to an immutable field change. type: boolean healthChecks: description: A list of resources to be included in the health assessment. items: - description: NamespacedObjectKindReference contains enough information - to let you locate the typed referenced object in any namespace + description: NamespacedObjectKindReference contains enough information to let you locate the typed referenced object in any namespace properties: apiVersion: - description: API version of the referent, if not specified the - Kubernetes preferred version will be used + description: API version of the referent, if not specified the Kubernetes preferred version will be used type: string kind: description: Kind of the referent @@ -110,8 +98,7 @@ spec: description: Name of the referent type: string namespace: - description: Namespace of the referent, when not specified it - acts as LocalObjectReference + description: Namespace of the referent, when not specified it acts as LocalObjectReference type: string required: - kind @@ -119,27 +106,21 @@ spec: type: object type: array images: - description: Images is a list of (image name, new name, new tag or - digest) for changing image names, tags or digests. This can also - be achieved with a patch, but this operator is simpler to specify. + description: Images is a list of (image name, new name, new tag or digest) for changing image names, tags or digests. This can also be achieved with a patch, but this operator is simpler to specify. items: - description: Image contains an image name, a new name, a new tag - or digest, which will replace the original name and tag. + description: Image contains an image name, a new name, a new tag or digest, which will replace the original name and tag. properties: digest: - description: Digest is the value used to replace the original - image tag. If digest is present NewTag value is ignored. + description: Digest is the value used to replace the original image tag. If digest is present NewTag value is ignored. type: string name: description: Name is a tag-less image name. type: string newName: - description: NewName is the value used to replace the original - name. + description: NewName is the value used to replace the original name. type: string newTag: - description: NewTag is the value used to replace the original - tag. + description: NewTag is the value used to replace the original tag. type: string required: - name @@ -149,19 +130,10 @@ spec: description: The interval at which to reconcile the Kustomization. type: string kubeConfig: - description: The KubeConfig for reconciling the Kustomization on a - remote cluster. When specified, KubeConfig takes precedence over - ServiceAccountName. + description: The KubeConfig for reconciling the Kustomization on a remote cluster. When specified, KubeConfig takes precedence over ServiceAccountName. properties: secretRef: - description: SecretRef holds the name to a secret that contains - a 'value' key with the kubeconfig file as the value. It must - be in the same namespace as the Kustomization. It is recommended - that the kubeconfig is self-contained, and the secret is regularly - updated if credentials such as a cloud-access-token expire. - Cloud specific `cmd-path` auth helpers will not function without - adding binaries and credentials to the Pod that is responsible - for reconciling the Kustomization. + description: SecretRef holds the name to a secret that contains a 'value' key with the kubeconfig file as the value. It must be in the same namespace as the Kustomization. It is recommended that the kubeconfig is self-contained, and the secret is regularly updated if credentials such as a cloud-access-token expire. Cloud specific `cmd-path` auth helpers will not function without adding binaries and credentials to the Pod that is responsible for reconciling the Kustomization. properties: name: description: Name of the referent @@ -170,15 +142,48 @@ spec: - name type: object type: object + patches: + description: Strategic merge and JSON patches, defined as inline YAML objects, capable of targeting objects based on kind, label and annotation selectors. + items: + description: Patch contains either a StrategicMerge or a JSON6902 patch, either a file or inline, and the target the patch should be applied to. + properties: + patch: + description: Patch contains the JSON6902 patch document with an array of operation objects. + type: string + target: + description: Target points to the resources that the patch document should be applied to. + properties: + annotationSelector: + description: AnnotationSelector is a string that follows the label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api It matches with the resource annotations. + type: string + group: + description: Group is the API group to select resources from. Together with Version and Kind it is capable of unambiguously identifying and/or selecting resources. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md + type: string + kind: + description: Kind of the API Group to select resources from. Together with Group and Version it is capable of unambiguously identifying and/or selecting resources. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md + type: string + labelSelector: + description: LabelSelector is a string that follows the label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api It matches with the resource labels. + type: string + name: + description: Name to match resources with. + type: string + namespace: + description: Namespace to select resources from. + type: string + version: + description: Version of the API Group to select resources from. Together with Group and Kind it is capable of unambiguously identifying and/or selecting resources. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md + type: string + type: object + type: object + type: array patchesJson6902: description: JSON 6902 patches, defined as inline YAML objects. items: - description: JSON6902Patch contains a JSON6902 patch and the target - the patch should be applied to. + description: JSON6902Patch contains a JSON6902 patch and the target the patch should be applied to. properties: patch: - description: Patch contains the JSON6902 patch document with - an array of operation objects. + description: Patch contains the JSON6902 patch document with an array of operation objects. items: description: JSON6902 is a JSON6902 operation object. https://tools.ietf.org/html/rfc6902#section-4 properties: @@ -203,29 +208,19 @@ spec: type: object type: array target: - description: Target points to the resources that the patch document - should be applied to. + description: Target points to the resources that the patch document should be applied to. properties: annotationSelector: - description: AnnotationSelector is a string that follows - the label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api - It matches with the resource annotations. + description: AnnotationSelector is a string that follows the label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api It matches with the resource annotations. type: string group: - description: Group is the API group to select resources - from. Together with Version and Kind it is capable of - unambiguously identifying and/or selecting resources. - https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md + description: Group is the API group to select resources from. Together with Version and Kind it is capable of unambiguously identifying and/or selecting resources. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md type: string kind: - description: Kind of the API Group to select resources from. - Together with Group and Version it is capable of unambiguously - identifying and/or selecting resources. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md + description: Kind of the API Group to select resources from. Together with Group and Version it is capable of unambiguously identifying and/or selecting resources. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md type: string labelSelector: - description: LabelSelector is a string that follows the - label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api - It matches with the resource labels. + description: LabelSelector is a string that follows the label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api It matches with the resource labels. type: string name: description: Name to match resources with. @@ -234,9 +229,7 @@ spec: description: Namespace to select resources from. type: string version: - description: Version of the API Group to select resources - from. Together with Group and Kind it is capable of unambiguously - identifying and/or selecting resources. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md + description: Version of the API Group to select resources from. Together with Group and Kind it is capable of unambiguously identifying and/or selecting resources. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md type: string type: object required: @@ -250,44 +243,29 @@ spec: x-kubernetes-preserve-unknown-fields: true type: array path: - description: Path to the directory containing the kustomization.yaml - file, or the set of plain YAMLs a kustomization.yaml should be generated - for. Defaults to 'None', which translates to the root path of the - SourceRef. + description: Path to the directory containing the kustomization.yaml file, or the set of plain YAMLs a kustomization.yaml should be generated for. Defaults to 'None', which translates to the root path of the SourceRef. type: string postBuild: - description: PostBuild describes which actions to perform on the YAML - manifest generated by building the kustomize overlay. + description: PostBuild describes which actions to perform on the YAML manifest generated by building the kustomize overlay. properties: substitute: additionalProperties: type: string - description: Substitute holds a map of key/value pairs. The variables - defined in your YAML manifests that match any of the keys defined - in the map will be substituted with the set value. Includes - support for bash string replacement functions e.g. ${var:=default}, - ${var:position} and ${var/substring/replacement}. + description: Substitute holds a map of key/value pairs. The variables defined in your YAML manifests that match any of the keys defined in the map will be substituted with the set value. Includes support for bash string replacement functions e.g. ${var:=default}, ${var:position} and ${var/substring/replacement}. type: object substituteFrom: - description: SubstituteFrom holds references to ConfigMaps and - Secrets containing the variables and their values to be substituted - in the YAML manifests. The ConfigMap and the Secret data keys - represent the var names and they must match the vars declared - in the manifests for the substitution to happen. + description: SubstituteFrom holds references to ConfigMaps and Secrets containing the variables and their values to be substituted in the YAML manifests. The ConfigMap and the Secret data keys represent the var names and they must match the vars declared in the manifests for the substitution to happen. items: - description: SubstituteReference contains a reference to a resource - containing the variables name and value. + description: SubstituteReference contains a reference to a resource containing the variables name and value. properties: kind: - description: Kind of the values referent, valid values are - ('Secret', 'ConfigMap'). + description: Kind of the values referent, valid values are ('Secret', 'ConfigMap'). enum: - Secret - ConfigMap type: string name: - description: Name of the values referent. Should reside - in the same namespace as the referring resource. + description: Name of the values referent. Should reside in the same namespace as the referring resource. maxLength: 253 minLength: 1 type: string @@ -301,17 +279,13 @@ spec: description: Prune enables garbage collection. type: boolean retryInterval: - description: The interval at which to retry a previously failed reconciliation. - When not specified, the controller uses the KustomizationSpec.Interval - value to retry failures. + description: The interval at which to retry a previously failed reconciliation. When not specified, the controller uses the KustomizationSpec.Interval value to retry failures. type: string serviceAccountName: - description: The name of the Kubernetes service account to impersonate - when reconciling this Kustomization. + description: The name of the Kubernetes service account to impersonate when reconciling this Kustomization. type: string sourceRef: - description: Reference of the source where the kustomization file - is. + description: Reference of the source where the kustomization file is. properties: apiVersion: description: API version of the referent @@ -326,34 +300,25 @@ spec: description: Name of the referent type: string namespace: - description: Namespace of the referent, defaults to the Kustomization - namespace + description: Namespace of the referent, defaults to the Kustomization namespace type: string required: - kind - name type: object suspend: - description: This flag tells the controller to suspend subsequent - kustomize executions, it does not apply to already started executions. - Defaults to false. + description: This flag tells the controller to suspend subsequent kustomize executions, it does not apply to already started executions. Defaults to false. type: boolean targetNamespace: - description: TargetNamespace sets or overrides the namespace in the - kustomization.yaml file. + description: TargetNamespace sets or overrides the namespace in the kustomization.yaml file. maxLength: 63 minLength: 1 type: string timeout: - description: Timeout for validation, apply and health checking operations. - Defaults to 'Interval' duration. + description: Timeout for validation, apply and health checking operations. Defaults to 'Interval' duration. type: string validation: - description: Validate the Kubernetes objects before applying them - on the cluster. The validation strategy can be 'client' (local dry-run), - 'server' (APIServer dry-run) or 'none'. When 'Force' is 'true', - validation will fallback to 'client' if set to 'server' because - server-side validation is not supported in this scenario. + description: Validate the Kubernetes objects before applying them on the cluster. The validation strategy can be 'client' (local dry-run), 'server' (APIServer dry-run) or 'none'. When 'Force' is 'true', validation will fallback to 'client' if set to 'server' because server-side validation is not supported in this scenario. enum: - none - client @@ -369,45 +334,23 @@ spec: properties: 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, - 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 }" + 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, 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. + 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. + 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. + 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. + 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_])?$ @@ -420,11 +363,7 @@ spec: - 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) + 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 @@ -437,16 +376,13 @@ spec: type: object type: array lastAppliedRevision: - description: The last successfully applied revision. The revision - format for Git sources is /. + description: The last successfully applied revision. The revision format for Git sources is /. type: string lastAttemptedRevision: - description: LastAttemptedRevision is the revision of the last reconciliation - attempt. + description: LastAttemptedRevision is the revision of the last reconciliation attempt. type: string lastHandledReconcileAt: - description: LastHandledReconcileAt holds the value of the most recent - reconcile request value, so a change can be detected. + description: LastHandledReconcileAt holds the value of the most recent reconcile request value, so a change can be detected. type: string observedGeneration: description: ObservedGeneration is the last reconciled generation. @@ -461,8 +397,7 @@ spec: entries: description: A list of Kubernetes kinds grouped by namespace. items: - description: Snapshot holds the metadata of namespaced Kubernetes - objects + description: Snapshot holds the metadata of namespaced Kubernetes objects properties: kinds: additionalProperties: From 3864290f7eadba95b9350ed7871e4e05ae2de822 Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Thu, 9 Sep 2021 16:17:09 +0700 Subject: [PATCH 02/11] add makefile targets for code formatting and check Signed-off-by: Chanwit Kaewkasi --- Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9178ef9..4681d79 100644 --- a/Makefile +++ b/Makefile @@ -3,11 +3,20 @@ SOURCE_CONTROLLER_VERSION := v0.15.4 KUSTOMIZE_CONTROLLER_VERSION := v0.14.0 HELM_CONTROLLER_VERSION := v0.11.2 -all: test build +all: dist/index.html fmt vet test build dist/index.html: npm run build +fmt: + go fmt ./... + npx prettier --write 'ui/**/*.ts(x)?' + npx eslint ui/ --ext .ts --ext .tsx --fix + +vet: + go vet ./... + npx eslint ui/ --ext .ts --ext .tsx + test: go test ./... From b5d5f624519cfc9239c0d96064c2e86d064763e0 Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Thu, 9 Sep 2021 16:17:57 +0700 Subject: [PATCH 03/11] add code formatter for TypeScript Signed-off-by: Chanwit Kaewkasi --- .eslintrc | 3 +- package-lock.json | 476 ++++++++++++++++++----------- package.json | 10 +- ui/components/AppStateProvider.tsx | 5 +- ui/lib/hooks/app.ts | 6 +- ui/lib/rpc/twirp.ts | 25 +- 6 files changed, 328 insertions(+), 197 deletions(-) diff --git a/.eslintrc b/.eslintrc index e2373e7..8d532ca 100644 --- a/.eslintrc +++ b/.eslintrc @@ -4,7 +4,8 @@ "plugin:import/errors", "plugin:import/warnings", "plugin:@typescript-eslint/recommended", - "plugin:import/typescript" + "plugin:import/typescript", + "plugin:prettier/recommended" // eslint shows prettier formatting warnings. Must be always the last configuration. ], "rules": { "import/default": 0, diff --git a/package-lock.json b/package-lock.json index 72ae9f8..7fe2838 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3590,15 +3590,15 @@ "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==" }, "@eslint/eslintrc": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.0.tgz", - "integrity": "sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog==", + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", + "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.1.1", "espree": "^7.3.0", - "globals": "^12.1.0", + "globals": "^13.9.0", "ignore": "^4.0.6", "import-fresh": "^3.2.1", "js-yaml": "^3.13.1", @@ -3607,21 +3607,21 @@ }, "dependencies": { "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "dev": true, "requires": { "ms": "2.1.2" } }, "globals": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "version": "13.11.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.11.0.tgz", + "integrity": "sha512-08/xrJ7wQjK9kkkRoI3OFUBbLx4f+6x3SGwcPvQ0QH6goFDrOU2oyAWrmh3dJezu65buo+HBMzAMQy6rovVC3g==", "dev": true, "requires": { - "type-fest": "^0.8.1" + "type-fest": "^0.20.2" } }, "ignore": { @@ -3657,9 +3657,49 @@ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + } + } + }, + "@humanwhocodes/config-array": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", + "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.0", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + }, + "dependencies": { + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true } } }, + "@humanwhocodes/object-schema": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz", + "integrity": "sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w==", + "dev": true + }, "@iarna/toml": { "version": "2.2.5", "resolved": "https://registry.npmjs.org/@iarna/toml/-/toml-2.2.5.tgz", @@ -4352,19 +4392,19 @@ } }, "@nodelib/fs.scandir": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", - "integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, "requires": { - "@nodelib/fs.stat": "2.0.4", + "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" }, "dependencies": { "@nodelib/fs.stat": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", - "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true } } @@ -4376,12 +4416,12 @@ "dev": true }, "@nodelib/fs.walk": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", - "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dev": true, "requires": { - "@nodelib/fs.scandir": "2.1.4", + "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" } }, @@ -4727,9 +4767,9 @@ } }, "@types/json-schema": { - "version": "7.0.7", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", - "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==", + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", + "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", "dev": true }, "@types/json5": { @@ -4887,25 +4927,24 @@ "integrity": "sha512-37RSHht+gzzgYeobbG+KWryeAW8J33Nhr69cjTqSYymXVZEN9NbRYWoYlRtDhHKPVT1FyNKwaTPC1NynKZpzRA==" }, "@typescript-eslint/eslint-plugin": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.17.0.tgz", - "integrity": "sha512-/fKFDcoHg8oNan39IKFOb5WmV7oWhQe1K6CDaAVfJaNWEhmfqlA24g+u1lqU5bMH7zuNasfMId4LaYWC5ijRLw==", + "version": "4.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.31.0.tgz", + "integrity": "sha512-iPKZTZNavAlOhfF4gymiSuUkgLne/nh5Oz2/mdiUmuZVD42m9PapnCnzjxuDsnpnbH3wT5s2D8bw6S39TC6GNw==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "4.17.0", - "@typescript-eslint/scope-manager": "4.17.0", - "debug": "^4.1.1", + "@typescript-eslint/experimental-utils": "4.31.0", + "@typescript-eslint/scope-manager": "4.31.0", + "debug": "^4.3.1", "functional-red-black-tree": "^1.0.1", - "lodash": "^4.17.15", - "regexpp": "^3.0.0", - "semver": "^7.3.2", - "tsutils": "^3.17.1" + "regexpp": "^3.1.0", + "semver": "^7.3.5", + "tsutils": "^3.21.0" }, "dependencies": { "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "dev": true, "requires": { "ms": "2.1.2" @@ -4918,9 +4957,9 @@ "dev": true }, "semver": { - "version": "7.3.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", - "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -4929,35 +4968,35 @@ } }, "@typescript-eslint/experimental-utils": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.17.0.tgz", - "integrity": "sha512-ZR2NIUbnIBj+LGqCFGQ9yk2EBQrpVVFOh9/Kd0Lm6gLpSAcCuLLe5lUCibKGCqyH9HPwYC0GIJce2O1i8VYmWA==", + "version": "4.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.31.0.tgz", + "integrity": "sha512-Hld+EQiKLMppgKKkdUsLeVIeEOrwKc2G983NmznY/r5/ZtZCDvIOXnXtwqJIgYz/ymsy7n7RGvMyrzf1WaSQrw==", "dev": true, "requires": { - "@types/json-schema": "^7.0.3", - "@typescript-eslint/scope-manager": "4.17.0", - "@typescript-eslint/types": "4.17.0", - "@typescript-eslint/typescript-estree": "4.17.0", - "eslint-scope": "^5.0.0", - "eslint-utils": "^2.0.0" + "@types/json-schema": "^7.0.7", + "@typescript-eslint/scope-manager": "4.31.0", + "@typescript-eslint/types": "4.31.0", + "@typescript-eslint/typescript-estree": "4.31.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" } }, "@typescript-eslint/parser": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.17.0.tgz", - "integrity": "sha512-KYdksiZQ0N1t+6qpnl6JeK9ycCFprS9xBAiIrw4gSphqONt8wydBw4BXJi3C11ywZmyHulvMaLjWsxDjUSDwAw==", + "version": "4.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.31.0.tgz", + "integrity": "sha512-oWbzvPh5amMuTmKaf1wp0ySxPt2ZXHnFQBN2Szu1O//7LmOvgaKTCIDNLK2NvzpmVd5A2M/1j/rujBqO37hj3w==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "4.17.0", - "@typescript-eslint/types": "4.17.0", - "@typescript-eslint/typescript-estree": "4.17.0", - "debug": "^4.1.1" + "@typescript-eslint/scope-manager": "4.31.0", + "@typescript-eslint/types": "4.31.0", + "@typescript-eslint/typescript-estree": "4.31.0", + "debug": "^4.3.1" }, "dependencies": { "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "dev": true, "requires": { "ms": "2.1.2" @@ -4972,40 +5011,40 @@ } }, "@typescript-eslint/scope-manager": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.17.0.tgz", - "integrity": "sha512-OJ+CeTliuW+UZ9qgULrnGpPQ1bhrZNFpfT/Bc0pzNeyZwMik7/ykJ0JHnQ7krHanFN9wcnPK89pwn84cRUmYjw==", + "version": "4.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.31.0.tgz", + "integrity": "sha512-LJ+xtl34W76JMRLjbaQorhR0hfRAlp3Lscdiz9NeI/8i+q0hdBZ7BsiYieLoYWqy+AnRigaD3hUwPFugSzdocg==", "dev": true, "requires": { - "@typescript-eslint/types": "4.17.0", - "@typescript-eslint/visitor-keys": "4.17.0" + "@typescript-eslint/types": "4.31.0", + "@typescript-eslint/visitor-keys": "4.31.0" } }, "@typescript-eslint/types": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.17.0.tgz", - "integrity": "sha512-RN5z8qYpJ+kXwnLlyzZkiJwfW2AY458Bf8WqllkondQIcN2ZxQowAToGSd9BlAUZDB5Ea8I6mqL2quGYCLT+2g==", + "version": "4.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.31.0.tgz", + "integrity": "sha512-9XR5q9mk7DCXgXLS7REIVs+BaAswfdHhx91XqlJklmqWpTALGjygWVIb/UnLh4NWhfwhR5wNe1yTyCInxVhLqQ==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.17.0.tgz", - "integrity": "sha512-lRhSFIZKUEPPWpWfwuZBH9trYIEJSI0vYsrxbvVvNyIUDoKWaklOAelsSkeh3E2VBSZiNe9BZ4E5tYBZbUczVQ==", + "version": "4.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.31.0.tgz", + "integrity": "sha512-QHl2014t3ptg+xpmOSSPn5hm4mY8D4s97ftzyk9BZ8RxYQ3j73XcwuijnJ9cMa6DO4aLXeo8XS3z1omT9LA/Eg==", "dev": true, "requires": { - "@typescript-eslint/types": "4.17.0", - "@typescript-eslint/visitor-keys": "4.17.0", - "debug": "^4.1.1", - "globby": "^11.0.1", + "@typescript-eslint/types": "4.31.0", + "@typescript-eslint/visitor-keys": "4.31.0", + "debug": "^4.3.1", + "globby": "^11.0.3", "is-glob": "^4.0.1", - "semver": "^7.3.2", - "tsutils": "^3.17.1" + "semver": "^7.3.5", + "tsutils": "^3.21.0" }, "dependencies": { "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "dev": true, "requires": { "ms": "2.1.2" @@ -5018,9 +5057,9 @@ "dev": true }, "semver": { - "version": "7.3.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", - "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -5029,12 +5068,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.17.0.tgz", - "integrity": "sha512-WfuMN8mm5SSqXuAr9NM+fItJ0SVVphobWYkWOwQ1odsfC014Vdxk/92t4JwS1Q6fCA/ABfCKpa3AVtpUKTNKGQ==", + "version": "4.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.31.0.tgz", + "integrity": "sha512-HUcRp2a9I+P21+O21yu3ezv3GEPGjyGiXoEUQwZXjR8UxRApGeLyWH4ZIIUSalE28aG4YsV6GjtaAVB3QKOu0w==", "dev": true, "requires": { - "@typescript-eslint/types": "4.17.0", + "@typescript-eslint/types": "4.31.0", "eslint-visitor-keys": "^2.0.0" } }, @@ -5084,9 +5123,9 @@ } }, "acorn-jsx": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", - "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true }, "acorn-walk": { @@ -6248,9 +6287,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001165", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001165.tgz", - "integrity": "sha512-8cEsSMwXfx7lWSUMA2s08z9dIgsnR5NAqjXP23stdsU3AUWkCr/rr4s4OFtHXn5XXr6+7kam3QFVoYyXNPdJPA==" + "version": "1.0.30001255", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001255.tgz", + "integrity": "sha512-F+A3N9jTZL882f/fg/WWVnKSu6IOo3ueLz4zwaOPbPYHNmM/ZaDUyzyJwS1mZhX7Ex5jqTyW599Gdelh5PDYLQ==" }, "capture-exit": { "version": "2.0.0", @@ -6631,11 +6670,6 @@ "node-releases": "^1.1.71" } }, - "caniuse-lite": { - "version": "1.0.30001228", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001228.tgz", - "integrity": "sha512-QQmLOGJ3DEgokHbMSA8cj2a+geXqmnpyOFT0lhQV6P3/YOJvGDEwoedcwxEQ30gJIwIIunHIicunJ2rzK5gB2A==" - }, "colorette": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", @@ -8182,29 +8216,32 @@ } }, "eslint": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.21.0.tgz", - "integrity": "sha512-W2aJbXpMNofUp0ztQaF40fveSsJBjlSCSWpy//gzfTvwC+USs/nceBrKmlJOiM8r1bLwP2EuYkCqArn/6QTIgg==", + "version": "7.32.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz", + "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==", "dev": true, "requires": { "@babel/code-frame": "7.12.11", - "@eslint/eslintrc": "^0.4.0", + "@eslint/eslintrc": "^0.4.3", + "@humanwhocodes/config-array": "^0.5.0", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.0.1", "doctrine": "^3.0.0", "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", "eslint-scope": "^5.1.1", "eslint-utils": "^2.1.0", "eslint-visitor-keys": "^2.0.0", "espree": "^7.3.1", "esquery": "^1.4.0", "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.0.0", - "globals": "^12.1.0", + "glob-parent": "^5.1.2", + "globals": "^13.6.0", "ignore": "^4.0.6", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", @@ -8212,7 +8249,7 @@ "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", - "lodash": "^4.17.20", + "lodash.merge": "^4.6.2", "minimatch": "^3.0.4", "natural-compare": "^1.4.0", "optionator": "^0.9.1", @@ -8221,7 +8258,7 @@ "semver": "^7.2.1", "strip-ansi": "^6.0.0", "strip-json-comments": "^3.1.0", - "table": "^6.0.4", + "table": "^6.0.9", "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" }, @@ -8251,9 +8288,9 @@ } }, "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -8287,14 +8324,37 @@ } }, "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "dev": true, "requires": { "ms": "2.1.2" } }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, "glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -8305,12 +8365,12 @@ } }, "globals": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "version": "13.11.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.11.0.tgz", + "integrity": "sha512-08/xrJ7wQjK9kkkRoI3OFUBbLx4f+6x3SGwcPvQ0QH6goFDrOU2oyAWrmh3dJezu65buo+HBMzAMQy6rovVC3g==", "dev": true, "requires": { - "type-fest": "^0.8.1" + "type-fest": "^0.20.2" } }, "has-flag": { @@ -8384,9 +8444,9 @@ "dev": true }, "semver": { - "version": "7.3.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", - "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -8440,6 +8500,12 @@ "prelude-ls": "^1.2.1" } }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -8451,6 +8517,12 @@ } } }, + "eslint-config-prettier": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz", + "integrity": "sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==", + "dev": true + }, "eslint-import-resolver-node": { "version": "0.3.4", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz", @@ -8504,6 +8576,15 @@ } } }, + "eslint-plugin-prettier": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.0.0.tgz", + "integrity": "sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==", + "dev": true, + "requires": { + "prettier-linter-helpers": "^1.0.0" + } + }, "eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -8515,26 +8596,18 @@ } }, "eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", "dev": true, "requires": { - "eslint-visitor-keys": "^1.1.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true - } + "eslint-visitor-keys": "^2.0.0" } }, "eslint-visitor-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", - "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", "dev": true }, "espree": { @@ -8878,6 +8951,12 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "fast-diff": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", + "dev": true + }, "fast-glob": { "version": "2.2.7", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.7.tgz", @@ -8909,9 +8988,9 @@ "dev": true }, "fastq": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", - "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.12.0.tgz", + "integrity": "sha512-VNX0QkHK3RsXVKr9KrlUv/FoTa0NdbYoHHl7uXHv2rzyHSlxjdNAKug2twd9luJxpcyNeAgf5iPPMutJO67Dfg==", "dev": true, "requires": { "reusify": "^1.0.4" @@ -9018,9 +9097,9 @@ } }, "flatted": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz", - "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.2.tgz", + "integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==", "dev": true }, "follow-redirects": { @@ -9209,9 +9288,9 @@ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" }, "globby": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.2.tgz", - "integrity": "sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og==", + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", + "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", "dev": true, "requires": { "array-union": "^2.1.0", @@ -9223,9 +9302,9 @@ }, "dependencies": { "@nodelib/fs.stat": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", - "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true }, "braces": { @@ -9238,17 +9317,16 @@ } }, "fast-glob": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", - "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", + "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.0", + "glob-parent": "^5.1.2", "merge2": "^1.3.0", - "micromatch": "^4.0.2", - "picomatch": "^2.2.1" + "micromatch": "^4.0.4" } }, "fill-range": { @@ -9276,15 +9354,21 @@ "dev": true }, "micromatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", - "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", "dev": true, "requires": { "braces": "^3.0.1", - "picomatch": "^2.0.5" + "picomatch": "^2.2.3" } }, + "picomatch": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "dev": true + }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -12301,6 +12385,12 @@ "integrity": "sha1-GVhwRQ9aExkkeN9Lw9I9LeoZB7Y=", "dev": true }, + "lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", + "dev": true + }, "lodash.debounce": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", @@ -12312,12 +12402,24 @@ "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", "dev": true }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "lodash.sortby": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", "dev": true }, + "lodash.truncate": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", + "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=", + "dev": true + }, "lodash.uniq": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", @@ -14462,11 +14564,20 @@ "dev": true }, "prettier": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", - "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz", + "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==", "dev": true }, + "prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "requires": { + "fast-diff": "^1.1.2" + } + }, "pretty-format": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz", @@ -14701,9 +14812,9 @@ "dev": true }, "queue-microtask": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.2.tgz", - "integrity": "sha512-dB15eXv3p2jDlbOiNLyMabYg1/sXvppd8DP2J3EOCQ0AkuSXCW2tP7mnVouVLJKgUMY6yP0kcQDVpLCN13h4Xg==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, "quote-stream": { @@ -15021,9 +15132,9 @@ } }, "regexpp": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", - "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", "dev": true }, "regexpu-core": { @@ -16155,21 +16266,23 @@ "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==" }, "table": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/table/-/table-6.0.7.tgz", - "integrity": "sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==", + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/table/-/table-6.7.1.tgz", + "integrity": "sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg==", "dev": true, "requires": { - "ajv": "^7.0.2", - "lodash": "^4.17.20", + "ajv": "^8.0.1", + "lodash.clonedeep": "^4.5.0", + "lodash.truncate": "^4.4.2", "slice-ansi": "^4.0.0", - "string-width": "^4.2.0" + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0" }, "dependencies": { "ajv": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.2.1.tgz", - "integrity": "sha512-+nu0HDv7kNSOua9apAVc979qd932rrZeb3WOvoiD31A/p1mIE5/9bN2027pE2rOPYEdS3UHzsvof4hY+lM9/WQ==", + "version": "8.6.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.2.tgz", + "integrity": "sha512-9807RlWAgT564wT+DjeyU5OFMPjmzxVobvDFmNAhY+5zD6A2ly3jDp6sgnfyDtlIQ+7H97oc/DGCzzfu9rjw9w==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -16178,11 +16291,26 @@ "uri-js": "^4.2.2" } }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, "json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "dev": true + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } } } }, diff --git a/package.json b/package.json index f901e8f..b5228aa 100644 --- a/package.json +++ b/package.json @@ -55,17 +55,19 @@ "ts-jest": "^26.5.6" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "^4.16.1", - "@typescript-eslint/parser": "^4.16.1", - "eslint": "^7.21.0", + "@typescript-eslint/eslint-plugin": "^4.31.0", + "@typescript-eslint/parser": "^4.31.0", + "eslint": "^7.32.0", + "eslint-config-prettier": "^8.3.0", "eslint-plugin-import": "^2.22.1", + "eslint-plugin-prettier": "^4.0.0", "express": "^4.17.1", "http-proxy": "^1.18.1", "morgan": "^1.10.0", "nodemon": "^2.0.6", "parcel": "1.12.3", "parcel-bundler": "1.12.3", - "prettier": "^2.2.1", + "prettier": "^2.3.2", "typescript": "^4.1.2" } } diff --git a/ui/components/AppStateProvider.tsx b/ui/components/AppStateProvider.tsx index 0bde694..ba5bfe2 100644 --- a/ui/components/AppStateProvider.tsx +++ b/ui/components/AppStateProvider.tsx @@ -29,9 +29,8 @@ export default function AppStateProvider({ clustersClient, ...props }) { const { context } = qs.parse(location.search); const [contexts, setContexts] = React.useState([]); const [namespaces, setNamespaces] = React.useState({}); - const [currentNamespace, setCurrentNamespace] = React.useState( - AllNamespacesOption - ); + const [currentNamespace, setCurrentNamespace] = + React.useState(AllNamespacesOption); const [appState, setAppState] = React.useState({ error: null, loading: false, diff --git a/ui/lib/hooks/app.ts b/ui/lib/hooks/app.ts index d0a4b0b..3b1344b 100644 --- a/ui/lib/hooks/app.ts +++ b/ui/lib/hooks/app.ts @@ -5,6 +5,7 @@ import { AppContext } from "../../components/AppStateProvider"; import { Context } from "../rpc/clusters"; import { AllNamespacesOption } from "../types"; import { formatURL, normalizePath, PageRoute } from "../util"; + // The backend doesn't like the word "all". Instead, it wants an empty string. // Navigation might get weird if we use an empty string on the front-end. // There may also be a naming collision with a namespace named "all". @@ -19,9 +20,8 @@ export function useKubernetesContexts(): { } { const { navigate } = useNavigation(); - const { contexts, namespaces, currentContext, currentNamespace } = useContext( - AppContext - ); + const { contexts, namespaces, currentContext, currentNamespace } = + useContext(AppContext); useEffect(() => { if (!currentContext) { diff --git a/ui/lib/rpc/twirp.ts b/ui/lib/rpc/twirp.ts index cf2faf9..fe1dd31 100644 --- a/ui/lib/rpc/twirp.ts +++ b/ui/lib/rpc/twirp.ts @@ -1,24 +1,25 @@ - export interface TwirpErrorJSON { - code: string; - msg: string; - meta: {[index:string]: string}; + code: string; + msg: string; + meta: { [index: string]: string }; } export class TwirpError extends Error { - code: string; - meta: {[index:string]: string}; + code: string; + meta: { [index: string]: string }; - constructor(te: TwirpErrorJSON) { - super(te.msg); + constructor(te: TwirpErrorJSON) { + super(te.msg); - this.code = te.code; - this.meta = te.meta; - } + this.code = te.code; + this.meta = te.meta; + } } export const throwTwirpError = (resp: Response) => { - return resp.json().then((err: TwirpErrorJSON) => { throw new TwirpError(err); }) + return resp.json().then((err: TwirpErrorJSON) => { + throw new TwirpError(err); + }); }; export const createTwirpRequest = (url: string, body: object, headersOverride: HeadersInit = {}): Request => { From e1bec127b1c810ccc7fa2543e858b6433bcad3fc Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Thu, 9 Sep 2021 16:18:43 +0700 Subject: [PATCH 04/11] fix context listing bug Signed-off-by: Chanwit Kaewkasi --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index af39a9f..48140c3 100644 --- a/main.go +++ b/main.go @@ -35,8 +35,8 @@ func initialContexts() (contexts []string, currentCtx string, err error) { return contexts, currentCtx, err } - for _, c := range rules.Contexts { - contexts = append(contexts, c.Cluster) + for contextName := range rules.Contexts { + contexts = append(contexts, contextName) } return contexts, rules.CurrentContext, nil From 858defeec177d2e405780d6d888bb3cdfd07f678 Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Thu, 9 Sep 2021 16:18:53 +0700 Subject: [PATCH 05/11] fix label of context combobox and refactoring Signed-off-by: Chanwit Kaewkasi --- ui/components/TopNav.tsx | 53 +++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/ui/components/TopNav.tsx b/ui/components/TopNav.tsx index 0868847..cae8993 100644 --- a/ui/components/TopNav.tsx +++ b/ui/components/TopNav.tsx @@ -69,14 +69,29 @@ const Styled = (c) => styled(c)` `; function TopNav({ className }: Props) { - const { - contexts, - namespaces, - currentContext, - currentNamespace, - } = useKubernetesContexts(); + const { contexts, namespaces, currentContext, currentNamespace } = + useKubernetesContexts(); + const { navigate, currentPage } = useNavigation(); + const contextSelectChanged = (ev) => { + const nextCtx = ev.target.value as string; + // setCurrentContext(nextCtx); + navigate(getNavValue(currentPage) as PageRoute, nextCtx, currentNamespace); + }; + + const namespaceSelectChanged = (ev) => { + const nextNs = ( + ev.target.value === allNamespaces ? AllNamespacesOption : ev.target.value + ) as string; + + navigate( + getNavValue(currentPage) as PageRoute, + currentContext, + (nextNs || AllNamespacesOption) as string + ); + }; + return (
@@ -90,21 +105,13 @@ function TopNav({ className }: Props) { - Context + Context {currentContext && contexts.length > 0 && ( { - const nextNs = (ev.target.value === allNamespaces - ? AllNamespacesOption - : ev.target.value) as string; - - navigate( - getNavValue(currentPage) as PageRoute, - currentContext, - (nextNs || AllNamespacesOption) as string - ); - }} + onChange={namespaceSelectChanged} // Avoid a material-ui warning value={ currentNamespace === "all" From 2a03952ddefa88eb0f8927bfe727af2cdb5187d2 Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Thu, 9 Sep 2021 16:19:53 +0700 Subject: [PATCH 06/11] update go module dependencies Signed-off-by: Chanwit Kaewkasi --- go.mod | 8 +++++--- go.sum | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1e16a8e..c38fa63 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/fluxcd/webui go 1.16 require ( + github.com/cespare/reflex v0.3.1 // indirect github.com/fluxcd/helm-controller/api v0.10.1 github.com/fluxcd/kustomize-controller/api v0.12.2 github.com/fluxcd/notification-controller/api v0.14.1 @@ -10,19 +11,20 @@ require ( github.com/fluxcd/pkg/runtime v0.11.0 github.com/fluxcd/source-controller/api v0.13.2 github.com/go-logr/logr v0.4.0 - github.com/golang/protobuf v1.4.3 + github.com/golang/protobuf v1.5.2 github.com/imdario/mergo v0.3.12 // indirect github.com/kr/text v0.2.0 // indirect github.com/onsi/ginkgo v1.14.2 github.com/onsi/gomega v1.10.2 github.com/prometheus/client_golang v1.7.1 github.com/stretchr/testify v1.7.0 // indirect - github.com/twitchtv/twirp v7.1.0+incompatible + github.com/twitchtv/twirp v8.1.0+incompatible + go.larrymyers.com/protoc-gen-twirp_typescript v0.0.0-20210412220659-c6a13478a8d8 // indirect golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b // indirect golang.org/x/net v0.0.0-20210326060303-6b1517762897 // indirect golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79 // indirect golang.org/x/tools v0.0.0-20200916195026-c9a70fc28ce3 // indirect - google.golang.org/protobuf v1.25.0 + google.golang.org/protobuf v1.27.1 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect k8s.io/api v0.20.4 k8s.io/apimachinery v0.20.4 diff --git a/go.sum b/go.sum index f171ed9..393da05 100644 --- a/go.sum +++ b/go.sum @@ -76,6 +76,8 @@ github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJm github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/reflex v0.3.1 h1:N4Y/UmRrjwOkNT0oQQnYsdr6YBxvHqtSfPB4mqOyAKk= +github.com/cespare/reflex v0.3.1/go.mod h1:I+0Pnu2W693i7Hv6ZZG76qHTY0mgUa7uCIfCtikXojE= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= @@ -103,6 +105,8 @@ github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwc github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= +github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -238,6 +242,9 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -247,6 +254,7 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= @@ -326,6 +334,8 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -379,6 +389,8 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/ogier/pflag v0.0.1 h1:RW6JSWSu/RkSatfcLtogGfFgpim5p7ARQ10ECk5O750= +github.com/ogier/pflag v0.0.1/go.mod h1:zkFki7tvTa0tafRvTBIZTvzYyAu6kQhPZFnshFFPE+g= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -440,6 +452,7 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= @@ -482,8 +495,11 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/twitchtv/twirp v5.5.0+incompatible/go.mod h1:RRJoFSAmTEh2weEqWtpPE3vFK5YBhA6bqp2l1kfCC5A= github.com/twitchtv/twirp v7.1.0+incompatible h1:3fNSDoSPyq+fTrifIvGue9XM/tptzuhiGY83rxPVNUg= github.com/twitchtv/twirp v7.1.0+incompatible/go.mod h1:RRJoFSAmTEh2weEqWtpPE3vFK5YBhA6bqp2l1kfCC5A= +github.com/twitchtv/twirp v8.1.0+incompatible h1:KGXanpa9LXdVE/V5P/tA27rkKFmXRGCtSNT7zdeeVOY= +github.com/twitchtv/twirp v8.1.0+incompatible/go.mod h1:RRJoFSAmTEh2weEqWtpPE3vFK5YBhA6bqp2l1kfCC5A= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= @@ -495,6 +511,8 @@ go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg= +go.larrymyers.com/protoc-gen-twirp_typescript v0.0.0-20210412220659-c6a13478a8d8 h1:TNgPDYTjgEpk4asMmdjrXcssCV3wLJV1JVsA2crtTOk= +go.larrymyers.com/protoc-gen-twirp_typescript v0.0.0-20210412220659-c6a13478a8d8/go.mod h1:51F13nJvsTFin0RTIOZL4z8RxGitAz4ww1TD21okMZs= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -793,6 +811,10 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From c19baec20ca359ea85a37e9778f2b0bb64d52226 Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Thu, 9 Sep 2021 16:20:13 +0700 Subject: [PATCH 07/11] rename labels to reflect Flux resources Signed-off-by: Chanwit Kaewkasi --- ui/pages/Sources.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/pages/Sources.tsx b/ui/pages/Sources.tsx index 32ff278..e938381 100644 --- a/ui/pages/Sources.tsx +++ b/ui/pages/Sources.tsx @@ -29,9 +29,9 @@ const Styled = (c) => styled(c)` `; const sections = [ - { value: SourceType.Git, label: "Git Repos" }, + { value: SourceType.Git, label: "Git Repositories" }, { value: SourceType.Bucket, label: "Buckets" }, - { value: SourceType.Helm, label: "Helm Repos" }, + { value: SourceType.Helm, label: "Helm Repositories" }, ]; function Sources({ className }: Props) { From e28a229b030f3454a15d5e44561b7af83d5d209a Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Thu, 9 Sep 2021 16:20:25 +0700 Subject: [PATCH 08/11] regenerated from protobuf Signed-off-by: Chanwit Kaewkasi --- pkg/rpc/clusters/clusters.pb.go | 4 +- pkg/rpc/clusters/clusters.proto | 1 - pkg/rpc/clusters/clusters.twirp.go | 377 ++++++++++++++++++----------- ui/lib/rpc/clusters.ts | 52 ++-- ui/lib/rpc/twirp.ts | 33 ++- 5 files changed, 282 insertions(+), 185 deletions(-) diff --git a/pkg/rpc/clusters/clusters.pb.go b/pkg/rpc/clusters/clusters.pb.go index b17e0e2..529e8af 100644 --- a/pkg/rpc/clusters/clusters.pb.go +++ b/pkg/rpc/clusters/clusters.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.15.8 // source: pkg/rpc/clusters/clusters.proto package clusters diff --git a/pkg/rpc/clusters/clusters.proto b/pkg/rpc/clusters/clusters.proto index bd3b97a..74bcc75 100644 --- a/pkg/rpc/clusters/clusters.proto +++ b/pkg/rpc/clusters/clusters.proto @@ -72,7 +72,6 @@ message Kustomization { repeated SnapshotEntry snapshots = 12; string lastAppliedRevision = 13; string lastAttemptedRevision = 14; - } message ListKustomizationsReq { diff --git a/pkg/rpc/clusters/clusters.twirp.go b/pkg/rpc/clusters/clusters.twirp.go index 95db54a..fe04e86 100644 --- a/pkg/rpc/clusters/clusters.twirp.go +++ b/pkg/rpc/clusters/clusters.twirp.go @@ -1,39 +1,32 @@ -// Code generated by protoc-gen-twirp v7.1.1, DO NOT EDIT. +// Code generated by protoc-gen-twirp v8.1.0, DO NOT EDIT. // source: pkg/rpc/clusters/clusters.proto -/* -Package clusters is a generated twirp stub package. -This code was generated with github.com/twitchtv/twirp/protoc-gen-twirp v7.1.1. - -It is generated from these files: - pkg/rpc/clusters/clusters.proto -*/ package clusters -import bytes "bytes" -import strings "strings" import context "context" import fmt "fmt" -import ioutil "io/ioutil" import http "net/http" +import ioutil "io/ioutil" +import json "encoding/json" import strconv "strconv" +import strings "strings" -import jsonpb "github.com/golang/protobuf/jsonpb" -import proto "github.com/golang/protobuf/proto" +import protojson "google.golang.org/protobuf/encoding/protojson" +import proto "google.golang.org/protobuf/proto" import twirp "github.com/twitchtv/twirp" import ctxsetters "github.com/twitchtv/twirp/ctxsetters" -// Imports only used by utility functions: +import bytes "bytes" +import errors "errors" import io "io" -import json "encoding/json" import path "path" import url "net/url" -// This is a compile-time assertion to ensure that this generated file -// is compatible with the twirp package used in your project. -// A compilation error at this line likely means your copy of the -// twirp package needs to be updated. -const _ = twirp.TwirpPackageIsVersion7 +// Version compatibility assertion. +// If the constant is not defined in the package, that likely means +// the package needs to be updated to work with this generated code. +// See https://twitchtv.github.io/twirp/docs/version_matrix.html +const _ = twirp.TwirpPackageMinVersion_8_1_0 // ================== // Clusters Interface @@ -86,9 +79,17 @@ func NewClustersProtobufClient(baseURL string, client HTTPClient, opts ...twirp. o(&clientOpts) } + // Using ReadOpt allows backwards and forwads compatibility with new options in the future + literalURLs := false + _ = clientOpts.ReadOpt("literalURLs", &literalURLs) + var pathPrefix string + if ok := clientOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { + pathPrefix = "/twirp" // default prefix + } + // Build method URLs: []/./ serviceURL := sanitizeBaseURL(baseURL) - serviceURL += baseServicePath(clientOpts.PathPrefix(), "clusters", "Clusters") + serviceURL += baseServicePath(pathPrefix, "clusters", "Clusters") urls := [11]string{ serviceURL + "ListContexts", serviceURL + "ListNamespacesForContext", @@ -640,9 +641,17 @@ func NewClustersJSONClient(baseURL string, client HTTPClient, opts ...twirp.Clie o(&clientOpts) } + // Using ReadOpt allows backwards and forwads compatibility with new options in the future + literalURLs := false + _ = clientOpts.ReadOpt("literalURLs", &literalURLs) + var pathPrefix string + if ok := clientOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { + pathPrefix = "/twirp" // default prefix + } + // Build method URLs: []/./ serviceURL := sanitizeBaseURL(baseURL) - serviceURL += baseServicePath(clientOpts.PathPrefix(), "clusters", "Clusters") + serviceURL += baseServicePath(pathPrefix, "clusters", "Clusters") urls := [11]string{ serviceURL + "ListContexts", serviceURL + "ListNamespacesForContext", @@ -1181,32 +1190,32 @@ type clustersServer struct { hooks *twirp.ServerHooks pathPrefix string // prefix for routing jsonSkipDefaults bool // do not include unpopulated fields (default values) in the response + jsonCamelCase bool // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names } // NewClustersServer builds a TwirpServer that can be used as an http.Handler to handle // HTTP requests that are routed to the right method in the provided svc implementation. // The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks). func NewClustersServer(svc Clusters, opts ...interface{}) TwirpServer { - serverOpts := twirp.ServerOptions{} - for _, opt := range opts { - switch o := opt.(type) { - case twirp.ServerOption: - o(&serverOpts) - case *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument - twirp.WithServerHooks(o)(&serverOpts) - case nil: // backwards compatibility, allow nil value for the argument - continue - default: - panic(fmt.Sprintf("Invalid option type %T on NewClustersServer", o)) - } + serverOpts := newServerOpts(opts) + + // Using ReadOpt allows backwards and forwads compatibility with new options in the future + jsonSkipDefaults := false + _ = serverOpts.ReadOpt("jsonSkipDefaults", &jsonSkipDefaults) + jsonCamelCase := false + _ = serverOpts.ReadOpt("jsonCamelCase", &jsonCamelCase) + var pathPrefix string + if ok := serverOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { + pathPrefix = "/twirp" // default prefix } return &clustersServer{ Clusters: svc, - pathPrefix: serverOpts.PathPrefix(), - interceptor: twirp.ChainInterceptors(serverOpts.Interceptors...), hooks: serverOpts.Hooks, - jsonSkipDefaults: serverOpts.JSONSkipDefaults, + interceptor: twirp.ChainInterceptors(serverOpts.Interceptors...), + pathPrefix: pathPrefix, + jsonSkipDefaults: jsonSkipDefaults, + jsonCamelCase: jsonCamelCase, } } @@ -1216,9 +1225,22 @@ func (s *clustersServer) writeError(ctx context.Context, resp http.ResponseWrite writeError(ctx, resp, err, s.hooks) } -// ClustersPathPrefix is a convenience constant that could used to identify URL paths. +// handleRequestBodyError is used to handle error when the twirp server cannot read request +func (s *clustersServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) { + if context.Canceled == ctx.Err() { + s.writeError(ctx, resp, twirp.NewError(twirp.Canceled, "failed to read request: context canceled")) + return + } + if context.DeadlineExceeded == ctx.Err() { + s.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, "failed to read request: deadline exceeded")) + return + } + s.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err)) +} + +// ClustersPathPrefix is a convenience constant that may identify URL paths. // Should be used with caution, it only matches routes generated by Twirp Go clients, -// that add a "/twirp" prefix by default, and use CamelCase service and method names. +// with the default "/twirp" prefix and default CamelCase service and method names. // More info: https://twitchtv.github.io/twirp/docs/routing.html const ClustersPathPrefix = "/twirp/clusters.Clusters/" @@ -1322,10 +1344,16 @@ func (s *clustersServer) serveListContextsJSON(ctx context.Context, resp http.Re return } + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } reqContent := new(ListContextsReq) - unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} - if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { - s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) return } @@ -1370,15 +1398,14 @@ func (s *clustersServer) serveListContextsJSON(ctx context.Context, resp http.Re ctx = callResponsePrepared(ctx, s.hooks) - var buf bytes.Buffer - marshaler := &jsonpb.Marshaler{OrigName: true, EmitDefaults: !s.jsonSkipDefaults} - if err = marshaler.Marshal(&buf, respContent); err != nil { + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) return } ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) - respBytes := buf.Bytes() resp.Header().Set("Content-Type", "application/json") resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) resp.WriteHeader(http.StatusOK) @@ -1402,7 +1429,7 @@ func (s *clustersServer) serveListContextsProtobuf(ctx context.Context, resp htt buf, err := ioutil.ReadAll(req.Body) if err != nil { - s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return } reqContent := new(ListContextsReq) @@ -1497,10 +1524,16 @@ func (s *clustersServer) serveListNamespacesForContextJSON(ctx context.Context, return } + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } reqContent := new(ListNamespacesForContextReq) - unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} - if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { - s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) return } @@ -1545,15 +1578,14 @@ func (s *clustersServer) serveListNamespacesForContextJSON(ctx context.Context, ctx = callResponsePrepared(ctx, s.hooks) - var buf bytes.Buffer - marshaler := &jsonpb.Marshaler{OrigName: true, EmitDefaults: !s.jsonSkipDefaults} - if err = marshaler.Marshal(&buf, respContent); err != nil { + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) return } ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) - respBytes := buf.Bytes() resp.Header().Set("Content-Type", "application/json") resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) resp.WriteHeader(http.StatusOK) @@ -1577,7 +1609,7 @@ func (s *clustersServer) serveListNamespacesForContextProtobuf(ctx context.Conte buf, err := ioutil.ReadAll(req.Body) if err != nil { - s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return } reqContent := new(ListNamespacesForContextReq) @@ -1672,10 +1704,16 @@ func (s *clustersServer) serveListKustomizationsJSON(ctx context.Context, resp h return } + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } reqContent := new(ListKustomizationsReq) - unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} - if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { - s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) return } @@ -1720,15 +1758,14 @@ func (s *clustersServer) serveListKustomizationsJSON(ctx context.Context, resp h ctx = callResponsePrepared(ctx, s.hooks) - var buf bytes.Buffer - marshaler := &jsonpb.Marshaler{OrigName: true, EmitDefaults: !s.jsonSkipDefaults} - if err = marshaler.Marshal(&buf, respContent); err != nil { + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) return } ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) - respBytes := buf.Bytes() resp.Header().Set("Content-Type", "application/json") resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) resp.WriteHeader(http.StatusOK) @@ -1752,7 +1789,7 @@ func (s *clustersServer) serveListKustomizationsProtobuf(ctx context.Context, re buf, err := ioutil.ReadAll(req.Body) if err != nil { - s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return } reqContent := new(ListKustomizationsReq) @@ -1847,10 +1884,16 @@ func (s *clustersServer) serveListSourcesJSON(ctx context.Context, resp http.Res return } + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } reqContent := new(ListSourcesReq) - unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} - if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { - s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) return } @@ -1895,15 +1938,14 @@ func (s *clustersServer) serveListSourcesJSON(ctx context.Context, resp http.Res ctx = callResponsePrepared(ctx, s.hooks) - var buf bytes.Buffer - marshaler := &jsonpb.Marshaler{OrigName: true, EmitDefaults: !s.jsonSkipDefaults} - if err = marshaler.Marshal(&buf, respContent); err != nil { + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) return } ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) - respBytes := buf.Bytes() resp.Header().Set("Content-Type", "application/json") resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) resp.WriteHeader(http.StatusOK) @@ -1927,7 +1969,7 @@ func (s *clustersServer) serveListSourcesProtobuf(ctx context.Context, resp http buf, err := ioutil.ReadAll(req.Body) if err != nil { - s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return } reqContent := new(ListSourcesReq) @@ -2022,10 +2064,16 @@ func (s *clustersServer) serveSyncKustomizationJSON(ctx context.Context, resp ht return } + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } reqContent := new(SyncKustomizationReq) - unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} - if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { - s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) return } @@ -2070,15 +2118,14 @@ func (s *clustersServer) serveSyncKustomizationJSON(ctx context.Context, resp ht ctx = callResponsePrepared(ctx, s.hooks) - var buf bytes.Buffer - marshaler := &jsonpb.Marshaler{OrigName: true, EmitDefaults: !s.jsonSkipDefaults} - if err = marshaler.Marshal(&buf, respContent); err != nil { + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) return } ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) - respBytes := buf.Bytes() resp.Header().Set("Content-Type", "application/json") resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) resp.WriteHeader(http.StatusOK) @@ -2102,7 +2149,7 @@ func (s *clustersServer) serveSyncKustomizationProtobuf(ctx context.Context, res buf, err := ioutil.ReadAll(req.Body) if err != nil { - s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return } reqContent := new(SyncKustomizationReq) @@ -2197,10 +2244,16 @@ func (s *clustersServer) serveListHelmReleasesJSON(ctx context.Context, resp htt return } + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } reqContent := new(ListHelmReleasesReq) - unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} - if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { - s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) return } @@ -2245,15 +2298,14 @@ func (s *clustersServer) serveListHelmReleasesJSON(ctx context.Context, resp htt ctx = callResponsePrepared(ctx, s.hooks) - var buf bytes.Buffer - marshaler := &jsonpb.Marshaler{OrigName: true, EmitDefaults: !s.jsonSkipDefaults} - if err = marshaler.Marshal(&buf, respContent); err != nil { + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) return } ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) - respBytes := buf.Bytes() resp.Header().Set("Content-Type", "application/json") resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) resp.WriteHeader(http.StatusOK) @@ -2277,7 +2329,7 @@ func (s *clustersServer) serveListHelmReleasesProtobuf(ctx context.Context, resp buf, err := ioutil.ReadAll(req.Body) if err != nil { - s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return } reqContent := new(ListHelmReleasesReq) @@ -2372,10 +2424,16 @@ func (s *clustersServer) serveListEventsJSON(ctx context.Context, resp http.Resp return } + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } reqContent := new(ListEventsReq) - unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} - if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { - s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) return } @@ -2420,15 +2478,14 @@ func (s *clustersServer) serveListEventsJSON(ctx context.Context, resp http.Resp ctx = callResponsePrepared(ctx, s.hooks) - var buf bytes.Buffer - marshaler := &jsonpb.Marshaler{OrigName: true, EmitDefaults: !s.jsonSkipDefaults} - if err = marshaler.Marshal(&buf, respContent); err != nil { + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) return } ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) - respBytes := buf.Bytes() resp.Header().Set("Content-Type", "application/json") resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) resp.WriteHeader(http.StatusOK) @@ -2452,7 +2509,7 @@ func (s *clustersServer) serveListEventsProtobuf(ctx context.Context, resp http. buf, err := ioutil.ReadAll(req.Body) if err != nil { - s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return } reqContent := new(ListEventsReq) @@ -2547,10 +2604,16 @@ func (s *clustersServer) serveSyncSourceJSON(ctx context.Context, resp http.Resp return } + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } reqContent := new(SyncSourceReq) - unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} - if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { - s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) return } @@ -2595,15 +2658,14 @@ func (s *clustersServer) serveSyncSourceJSON(ctx context.Context, resp http.Resp ctx = callResponsePrepared(ctx, s.hooks) - var buf bytes.Buffer - marshaler := &jsonpb.Marshaler{OrigName: true, EmitDefaults: !s.jsonSkipDefaults} - if err = marshaler.Marshal(&buf, respContent); err != nil { + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) return } ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) - respBytes := buf.Bytes() resp.Header().Set("Content-Type", "application/json") resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) resp.WriteHeader(http.StatusOK) @@ -2627,7 +2689,7 @@ func (s *clustersServer) serveSyncSourceProtobuf(ctx context.Context, resp http. buf, err := ioutil.ReadAll(req.Body) if err != nil { - s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return } reqContent := new(SyncSourceReq) @@ -2722,10 +2784,16 @@ func (s *clustersServer) serveSyncHelmReleaseJSON(ctx context.Context, resp http return } + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } reqContent := new(SyncHelmReleaseReq) - unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} - if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { - s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) return } @@ -2770,15 +2838,14 @@ func (s *clustersServer) serveSyncHelmReleaseJSON(ctx context.Context, resp http ctx = callResponsePrepared(ctx, s.hooks) - var buf bytes.Buffer - marshaler := &jsonpb.Marshaler{OrigName: true, EmitDefaults: !s.jsonSkipDefaults} - if err = marshaler.Marshal(&buf, respContent); err != nil { + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) return } ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) - respBytes := buf.Bytes() resp.Header().Set("Content-Type", "application/json") resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) resp.WriteHeader(http.StatusOK) @@ -2802,7 +2869,7 @@ func (s *clustersServer) serveSyncHelmReleaseProtobuf(ctx context.Context, resp buf, err := ioutil.ReadAll(req.Body) if err != nil { - s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return } reqContent := new(SyncHelmReleaseReq) @@ -2897,10 +2964,16 @@ func (s *clustersServer) serveGetReconciledObjectsJSON(ctx context.Context, resp return } + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } reqContent := new(GetReconciledObjectsReq) - unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} - if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { - s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) return } @@ -2945,15 +3018,14 @@ func (s *clustersServer) serveGetReconciledObjectsJSON(ctx context.Context, resp ctx = callResponsePrepared(ctx, s.hooks) - var buf bytes.Buffer - marshaler := &jsonpb.Marshaler{OrigName: true, EmitDefaults: !s.jsonSkipDefaults} - if err = marshaler.Marshal(&buf, respContent); err != nil { + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) return } ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) - respBytes := buf.Bytes() resp.Header().Set("Content-Type", "application/json") resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) resp.WriteHeader(http.StatusOK) @@ -2977,7 +3049,7 @@ func (s *clustersServer) serveGetReconciledObjectsProtobuf(ctx context.Context, buf, err := ioutil.ReadAll(req.Body) if err != nil { - s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return } reqContent := new(GetReconciledObjectsReq) @@ -3072,10 +3144,16 @@ func (s *clustersServer) serveGetChildObjectsJSON(ctx context.Context, resp http return } + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } reqContent := new(GetChildObjectsReq) - unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} - if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { - s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) return } @@ -3120,15 +3198,14 @@ func (s *clustersServer) serveGetChildObjectsJSON(ctx context.Context, resp http ctx = callResponsePrepared(ctx, s.hooks) - var buf bytes.Buffer - marshaler := &jsonpb.Marshaler{OrigName: true, EmitDefaults: !s.jsonSkipDefaults} - if err = marshaler.Marshal(&buf, respContent); err != nil { + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) return } ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) - respBytes := buf.Bytes() resp.Header().Set("Content-Type", "application/json") resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) resp.WriteHeader(http.StatusOK) @@ -3152,7 +3229,7 @@ func (s *clustersServer) serveGetChildObjectsProtobuf(ctx context.Context, resp buf, err := ioutil.ReadAll(req.Body) if err != nil { - s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return } reqContent := new(GetChildObjectsReq) @@ -3225,7 +3302,7 @@ func (s *clustersServer) ServiceDescriptor() ([]byte, int) { } func (s *clustersServer) ProtocGenTwirpVersion() string { - return "v7.1.1" + return "v8.1.0" } // PathPrefix returns the base service path, in the form: "//./" @@ -3261,7 +3338,7 @@ type TwirpServer interface { // ServiceDescriptor returns gzipped bytes describing the .proto file that // this service was generated from. Once unzipped, the bytes can be // unmarshalled as a - // github.com/golang/protobuf/protoc-gen-go/descriptor.FileDescriptorProto. + // google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto. // // The returned integer is the index of this particular service within that // FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a @@ -3279,6 +3356,23 @@ type TwirpServer interface { PathPrefix() string } +func newServerOpts(opts []interface{}) *twirp.ServerOptions { + serverOpts := &twirp.ServerOptions{} + for _, opt := range opts { + switch o := opt.(type) { + case twirp.ServerOption: + o(serverOpts) + case *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument + twirp.WithServerHooks(o)(serverOpts) + case nil: // backwards compatibility, allow nil value for the argument + continue + default: + panic(fmt.Sprintf("Invalid option type %T, please use a twirp.ServerOption", o)) + } + } + return serverOpts +} + // WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). // Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. // If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err) @@ -3288,9 +3382,9 @@ func WriteError(resp http.ResponseWriter, err error) { // writeError writes Twirp errors in the response and triggers hooks. func writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) { - // Non-twirp errors are wrapped as Internal (default) - twerr, ok := err.(twirp.Error) - if !ok { + // Convert to a twirp.Error. Non-twirp errors are converted to internal errors. + var twerr twirp.Error + if !errors.As(err, &twerr) { twerr = twirp.InternalErrorWith(err) } @@ -3398,7 +3492,7 @@ func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType } req.Header.Set("Accept", contentType) req.Header.Set("Content-Type", contentType) - req.Header.Set("Twirp-Version", "v7.1.1") + req.Header.Set("Twirp-Version", "v8.1.0") return req, nil } @@ -3671,16 +3765,16 @@ func doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.Clie // doJSONRequest makes a JSON request to the remote Twirp service. func doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) { - reqBody := bytes.NewBuffer(nil) - marshaler := &jsonpb.Marshaler{OrigName: true} - if err = marshaler.Marshal(reqBody, in); err != nil { + marshaler := &protojson.MarshalOptions{UseProtoNames: true} + reqBytes, err := marshaler.Marshal(in) + if err != nil { return ctx, wrapInternal(err, "failed to marshal json request") } if err = ctx.Err(); err != nil { return ctx, wrapInternal(err, "aborted because context was done") } - req, err := newRequest(ctx, url, reqBody, "application/json") + req, err := newRequest(ctx, url, bytes.NewReader(reqBytes), "application/json") if err != nil { return ctx, wrapInternal(err, "could not build request") } @@ -3710,8 +3804,13 @@ func doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHo return ctx, errorFromResponse(resp) } - unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} - if err = unmarshaler.Unmarshal(resp.Body, out); err != nil { + d := json.NewDecoder(resp.Body) + rawRespBody := json.RawMessage{} + if err := d.Decode(&rawRespBody); err != nil { + return ctx, wrapInternal(err, "failed to unmarshal json response") + } + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawRespBody, out); err != nil { return ctx, wrapInternal(err, "failed to unmarshal json response") } if err = ctx.Err(); err != nil { diff --git a/ui/lib/rpc/clusters.ts b/ui/lib/rpc/clusters.ts index 271aa66..83fcc67 100644 --- a/ui/lib/rpc/clusters.ts +++ b/ui/lib/rpc/clusters.ts @@ -1,4 +1,4 @@ -import { createTwirpRequest, Fetch, throwTwirpError } from "./twirp"; +import { createTwirpRequest, throwTwirpError, Fetch } from "./twirp"; export interface Context { name?: string; @@ -292,10 +292,9 @@ const JSONToListKustomizationsRes = ( return null; } return { - kustomizations: (m.kustomizations as ( - | Kustomization - | KustomizationJSON - )[]).map(JSONToKustomization), + kustomizations: ( + m.kustomizations as (Kustomization | KustomizationJSON)[] + ).map(JSONToKustomization), }; }; @@ -639,12 +638,14 @@ const JSONToListHelmReleasesRes = ( return null; } return { - helmReleases: (((m as ListHelmReleasesRes).helmReleases - ? (m as ListHelmReleasesRes).helmReleases - : (m as ListHelmReleasesResJSON).helm_releases) as ( - | HelmRelease - | HelmReleaseJSON - )[]).map(JSONToHelmRelease), + helmReleases: ( + ((m as ListHelmReleasesRes).helmReleases + ? (m as ListHelmReleasesRes).helmReleases + : (m as ListHelmReleasesResJSON).helm_releases) as ( + | HelmRelease + | HelmReleaseJSON + )[] + ).map(JSONToHelmRelease), }; }; @@ -871,10 +872,6 @@ export interface UnstructuredObject { status?: string; } -export type UnstructuredObjectWithParent = UnstructuredObject & { - parentUid: string; -}; - interface UnstructuredObjectJSON { groupVersionKind?: GroupVersionKindJSON; name?: string; @@ -1047,9 +1044,8 @@ export class DefaultClusters implements Clusters { listNamespacesForContextReq: ListNamespacesForContextReq ): Promise { const url = this.hostname + this.pathPrefix + "ListNamespacesForContext"; - let body: - | ListNamespacesForContextReq - | ListNamespacesForContextReqJSON = listNamespacesForContextReq; + let body: ListNamespacesForContextReq | ListNamespacesForContextReqJSON = + listNamespacesForContextReq; if (!this.writeCamelCase) { body = ListNamespacesForContextReqToJSON(listNamespacesForContextReq); } @@ -1068,9 +1064,8 @@ export class DefaultClusters implements Clusters { listKustomizationsReq: ListKustomizationsReq ): Promise { const url = this.hostname + this.pathPrefix + "ListKustomizations"; - let body: - | ListKustomizationsReq - | ListKustomizationsReqJSON = listKustomizationsReq; + let body: ListKustomizationsReq | ListKustomizationsReqJSON = + listKustomizationsReq; if (!this.writeCamelCase) { body = ListKustomizationsReqToJSON(listKustomizationsReq); } @@ -1106,9 +1101,8 @@ export class DefaultClusters implements Clusters { syncKustomizationReq: SyncKustomizationReq ): Promise { const url = this.hostname + this.pathPrefix + "SyncKustomization"; - let body: - | SyncKustomizationReq - | SyncKustomizationReqJSON = syncKustomizationReq; + let body: SyncKustomizationReq | SyncKustomizationReqJSON = + syncKustomizationReq; if (!this.writeCamelCase) { body = SyncKustomizationReqToJSON(syncKustomizationReq); } @@ -1127,9 +1121,8 @@ export class DefaultClusters implements Clusters { listHelmReleasesReq: ListHelmReleasesReq ): Promise { const url = this.hostname + this.pathPrefix + "ListHelmReleases"; - let body: - | ListHelmReleasesReq - | ListHelmReleasesReqJSON = listHelmReleasesReq; + let body: ListHelmReleasesReq | ListHelmReleasesReqJSON = + listHelmReleasesReq; if (!this.writeCamelCase) { body = ListHelmReleasesReqToJSON(listHelmReleasesReq); } @@ -1201,9 +1194,8 @@ export class DefaultClusters implements Clusters { getReconciledObjectsReq: GetReconciledObjectsReq ): Promise { const url = this.hostname + this.pathPrefix + "GetReconciledObjects"; - let body: - | GetReconciledObjectsReq - | GetReconciledObjectsReqJSON = getReconciledObjectsReq; + let body: GetReconciledObjectsReq | GetReconciledObjectsReqJSON = + getReconciledObjectsReq; if (!this.writeCamelCase) { body = GetReconciledObjectsReqToJSON(getReconciledObjectsReq); } diff --git a/ui/lib/rpc/twirp.ts b/ui/lib/rpc/twirp.ts index fe1dd31..2ab0bf8 100644 --- a/ui/lib/rpc/twirp.ts +++ b/ui/lib/rpc/twirp.ts @@ -22,18 +22,25 @@ export const throwTwirpError = (resp: Response) => { }); }; -export const createTwirpRequest = (url: string, body: object, headersOverride: HeadersInit = {}): Request => { - const headers = { - ...{ - "Content-Type": "application/json" - }, - ...headersOverride - }; - return new Request(url, { - method: "POST", - headers, - body: JSON.stringify(body) - }); +export const createTwirpRequest = ( + url: string, + body: object, + headersOverride: HeadersInit = {} +): Request => { + const headers = { + ...{ + "Content-Type": "application/json", + }, + ...headersOverride, + }; + return new Request(url, { + method: "POST", + headers, + body: JSON.stringify(body), + }); }; -export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise; +export type Fetch = ( + input: RequestInfo, + init?: RequestInit +) => Promise; From 590ea3c2a99aabd66f6f2600461d2163c0ebdd40 Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Thu, 9 Sep 2021 16:20:37 +0700 Subject: [PATCH 09/11] rename binary in readme Signed-off-by: Chanwit Kaewkasi --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 21e071e..ec87e80 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ To install the Flux Web UI: 1. Download the latest release from the [releases page](https://github.com/fluxcd/webui/releases) 2. Extract the binary from the downloaded archive -3. Run the server in your terminal: `./flux_webui` +3. Run the server in your terminal: `./flux-webui` 4. You will see a log message letting you know startup was successful: `2021-06-03T13:26:37.552-0700 INFO Serving on port 9000` 5. Navigate to [http://localhost:9000](http://localhost:9000) From de62f48a276552942687f5b7d5c407a2ea92924d Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Thu, 9 Sep 2021 16:20:51 +0700 Subject: [PATCH 10/11] add one-line installation script Signed-off-by: Chanwit Kaewkasi --- install/flux-webui.sh | 223 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 223 insertions(+) create mode 100644 install/flux-webui.sh diff --git a/install/flux-webui.sh b/install/flux-webui.sh new file mode 100644 index 0000000..8404278 --- /dev/null +++ b/install/flux-webui.sh @@ -0,0 +1,223 @@ +#!/usr/bin/env bash +set -e + +DEFAULT_BIN_DIR="/usr/local/bin" +BIN_DIR=${1:-"${DEFAULT_BIN_DIR}"} +GITHUB_REPO="fluxcd/webui" + +# Helper functions for logs +info() { + echo '[INFO] ' "$@" +} + +warn() { + echo '[WARN] ' "$@" >&2 +} + +fatal() { + echo '[ERROR] ' "$@" >&2 + exit 1 +} + +# Set os, fatal if operating system not supported +setup_verify_os() { + if [[ -z "${OS}" ]]; then + OS=$(uname) + fi + case ${OS} in + Darwin) + OS=darwin + ;; + Linux) + OS=linux + ;; + *) + fatal "Unsupported operating system ${OS}" + esac +} + +# Set arch, fatal if architecture not supported +setup_verify_arch() { + if [[ -z "${ARCH}" ]]; then + ARCH=$(uname -m) + fi + case ${ARCH} in + arm|armv6l|armv7l) + ARCH=arm + ;; + arm64|aarch64|armv8l) + ARCH=arm64 + ;; + amd64) + ARCH=amd64 + ;; + x86_64) + ARCH=amd64 + ;; + *) + fatal "Unsupported architecture ${ARCH}" + esac +} + +# Verify existence of downloader executable +verify_downloader() { + # Return failure if it doesn't exist or is no executable + [[ -x "$(which "$1")" ]] || return 1 + + # Set verified executable as our downloader program and return success + DOWNLOADER=$1 + return 0 +} + +# Create tempory directory and cleanup when done +setup_tmp() { + TMP_DIR=$(mktemp -d -t flux-install.XXXXXXXXXX) + TMP_METADATA="${TMP_DIR}/flux-webui.json" + TMP_HASH="${TMP_DIR}/flux-webui.hash" + TMP_BIN="${TMP_DIR}/flux-webui.tar.gz" + cleanup() { + local code=$? + set +e + trap - EXIT + rm -rf "${TMP_DIR}" + exit ${code} + } + trap cleanup INT EXIT +} + +# Find version from Github metadata +get_release_version() { + METADATA_URL="https://api.github.com/repos/${GITHUB_REPO}/releases/latest" + + info "Downloading metadata ${METADATA_URL}" + download "${TMP_METADATA}" "${METADATA_URL}" + + VERSION_FLUX_WEBUI=$(grep '"tag_name":' "${TMP_METADATA}" | sed -E 's/.*"([^"]+)".*/\1/' | cut -c 2-) + if [[ -n "${VERSION_FLUX_WEBUI}" ]]; then + info "Using ${VERSION_FLUX_WEBUI} as release" + else + fatal "Unable to determine release version" + fi +} + +# Download from file from URL +download() { + [[ $# -eq 2 ]] || fatal 'download needs exactly 2 arguments' + + case $DOWNLOADER in + curl) + curl -o "$1" -sfL "$2" + ;; + wget) + wget -qO "$1" "$2" + ;; + *) + fatal "Incorrect executable '${DOWNLOADER}'" + ;; + esac + + # Abort if download command failed + [[ $? -eq 0 ]] || fatal 'Download failed' +} + +# Version comparison +# Returns 0 on '=', 1 on '>', and 2 on '<'. +# Ref: https://stackoverflow.com/a/4025065 +vercomp () { + if [[ $1 == $2 ]] + then + return 0 + fi + local IFS=. + local i ver1=($1) ver2=($2) + # fill empty fields in ver1 with zeros + for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)) + do + ver1[i]=0 + done + for ((i=0; i<${#ver1[@]}; i++)) + do + if [[ -z ${ver2[i]} ]] + then + # fill empty fields in ver2 with zeros + ver2[i]=0 + fi + if ((10#${ver1[i]} > 10#${ver2[i]})) + then + return 1 + fi + if ((10#${ver1[i]} < 10#${ver2[i]})) + then + return 2 + fi + done + return 0 +} + +# Download hash from Github URL +download_hash() { + HASH_URL="https://github.com/${GITHUB_REPO}/releases/download/v${VERSION_FLUX_WEBUI}/flux-webui_${VERSION_FLUX_WEBUI}_checksums.txt" + info "Downloading hash ${HASH_URL}" + download "${TMP_HASH}" "${HASH_URL}" + HASH_EXPECTED=$(grep " flux-webui_${VERSION_FLUX_WEBUI}_${OS}_${ARCH}.tar.gz$" "${TMP_HASH}") + HASH_EXPECTED=${HASH_EXPECTED%%[[:blank:]]*} +} + +# Download binary from Github URL +download_binary() { + BIN_URL="https://github.com/${GITHUB_REPO}/releases/download/v${VERSION_FLUX_WEBUI}/flux-webui_${VERSION_FLUX_WEBUI}_${OS}_${ARCH}.tar.gz" + info "Downloading binary ${BIN_URL}" + download "${TMP_BIN}" "${BIN_URL}" +} + +compute_sha256sum() { + cmd=$(which sha256sum shasum | head -n 1) + case $(basename "$cmd") in + sha256sum) + sha256sum "$1" | cut -f 1 -d ' ' + ;; + shasum) + shasum -a 256 "$1" | cut -f 1 -d ' ' + ;; + *) + fatal "Can not find sha256sum or shasum to compute checksum" + ;; + esac +} + +# Verify downloaded binary hash +verify_binary() { + info "Verifying binary download" + HASH_BIN=$(compute_sha256sum "${TMP_BIN}") + HASH_BIN=${HASH_BIN%%[[:blank:]]*} + if [[ "${HASH_EXPECTED}" != "${HASH_BIN}" ]]; then + fatal "Download sha256 does not match ${HASH_EXPECTED}, got ${HASH_BIN}" + fi +} + +# Setup permissions and move binary +setup_binary() { + chmod 755 "${TMP_BIN}" + info "Installing Flux WebUI to ${BIN_DIR}/flux-webui" + tar -xzof "${TMP_BIN}" -C "${TMP_DIR}" + + local CMD_MOVE="mv -f \"${TMP_DIR}/flux-webui\" \"${BIN_DIR}\"" + if [[ -w "${BIN_DIR}" ]]; then + eval "${CMD_MOVE}" + else + eval "sudo ${CMD_MOVE}" + fi +} + +# Run the install process +{ + setup_verify_os + setup_verify_arch + verify_downloader curl || verify_downloader wget || fatal 'Can not find curl or wget for downloading files' + setup_tmp + get_release_version + download_hash + download_binary + verify_binary + setup_binary +} \ No newline at end of file From e8301cbf915fe66c73ac2ae6ee22afcbaec32072 Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Thu, 9 Sep 2021 16:22:03 +0700 Subject: [PATCH 11/11] update gitignore Signed-off-by: Chanwit Kaewkasi --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ce30864..2d12290 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules .cache dist bin +.idea/*