mirror of https://github.com/k3s-io/k3s
Update helm-controller for HelmChartConfig CRD (#2114)
* Update helm-controller for HelmChartConfig CRD Signed-off-by: Brad Davidson <brad.davidson@rancher.com>pull/2150/head
parent
a2471a1f8a
commit
c980fa68a0
2
go.mod
2
go.mod
|
@ -95,7 +95,7 @@ require (
|
||||||
github.com/opencontainers/selinux v1.5.3-0.20200613095409-bb88c45a3863
|
github.com/opencontainers/selinux v1.5.3-0.20200613095409-bb88c45a3863
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
github.com/rancher/dynamiclistener v0.2.1
|
github.com/rancher/dynamiclistener v0.2.1
|
||||||
github.com/rancher/helm-controller v0.6.5
|
github.com/rancher/helm-controller v0.7.0
|
||||||
github.com/rancher/kine v0.4.0
|
github.com/rancher/kine v0.4.0
|
||||||
github.com/rancher/remotedialer v0.2.0
|
github.com/rancher/remotedialer v0.2.0
|
||||||
github.com/rancher/spur v0.0.0-20200617165101-8702c8e4ce7a
|
github.com/rancher/spur v0.0.0-20200617165101-8702c8e4ce7a
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -640,8 +640,8 @@ github.com/rancher/go-powershell v0.0.0-20200701182037-6845e6fcfa79 h1:UeC0rjrIe
|
||||||
github.com/rancher/go-powershell v0.0.0-20200701182037-6845e6fcfa79/go.mod h1:xi4WpK6Op4m1Lknq61/e+VSjYlTs9bulVOaDNyBdzvk=
|
github.com/rancher/go-powershell v0.0.0-20200701182037-6845e6fcfa79/go.mod h1:xi4WpK6Op4m1Lknq61/e+VSjYlTs9bulVOaDNyBdzvk=
|
||||||
github.com/rancher/go-powershell v0.0.0-20200701184732-233247d45373 h1:BePi97poJ4hXnkP9yX96EmNQgMg+dGScvB1sqIheJ7w=
|
github.com/rancher/go-powershell v0.0.0-20200701184732-233247d45373 h1:BePi97poJ4hXnkP9yX96EmNQgMg+dGScvB1sqIheJ7w=
|
||||||
github.com/rancher/go-powershell v0.0.0-20200701184732-233247d45373/go.mod h1:Vz8oLnHgttpo/aZrTpjbcpZEDzzElqNau2zmorToY0E=
|
github.com/rancher/go-powershell v0.0.0-20200701184732-233247d45373/go.mod h1:Vz8oLnHgttpo/aZrTpjbcpZEDzzElqNau2zmorToY0E=
|
||||||
github.com/rancher/helm-controller v0.6.5 h1:gL6R3fbsBFBnrp2Wc36zn0zLQ8q2ckbLpfaN2XkrLVE=
|
github.com/rancher/helm-controller v0.7.0 h1:UMMRwTpBzUt2mPH89vFNm4pVpUHPaFj1Z5+WnS7jEOk=
|
||||||
github.com/rancher/helm-controller v0.6.5/go.mod h1:ZylsxIMGNADRPRNW+NiBWhrwwks9vnKLQiCHYWb6Bi0=
|
github.com/rancher/helm-controller v0.7.0/go.mod h1:ZylsxIMGNADRPRNW+NiBWhrwwks9vnKLQiCHYWb6Bi0=
|
||||||
github.com/rancher/kine v0.4.0 h1:1IhWy3TzjExG8xnj46eyUEWdzqNAD1WrgL4eEBKm6Uc=
|
github.com/rancher/kine v0.4.0 h1:1IhWy3TzjExG8xnj46eyUEWdzqNAD1WrgL4eEBKm6Uc=
|
||||||
github.com/rancher/kine v0.4.0/go.mod h1:IImtCJ68AIkE+VY/kUI0NkyJL5q5WzO8QvMsSXqbrpA=
|
github.com/rancher/kine v0.4.0/go.mod h1:IImtCJ68AIkE+VY/kUI0NkyJL5q5WzO8QvMsSXqbrpA=
|
||||||
github.com/rancher/kubernetes v1.18.8-k3s1 h1:dqukpA38pR5V7opoTDDslVYIxlM3sP5535u3Zd23W2I=
|
github.com/rancher/kubernetes v1.18.8-k3s1 h1:dqukpA38pR5V7opoTDDslVYIxlM3sP5535u3Zd23W2I=
|
||||||
|
|
|
@ -63,7 +63,8 @@ func crds(ctx context.Context, config *rest.Config) error {
|
||||||
|
|
||||||
factory.BatchCreateCRDs(ctx, crd.NamespacedTypes(
|
factory.BatchCreateCRDs(ctx, crd.NamespacedTypes(
|
||||||
"Addon.k3s.cattle.io/v1",
|
"Addon.k3s.cattle.io/v1",
|
||||||
"HelmChart.helm.cattle.io/v1")...)
|
"HelmChart.helm.cattle.io/v1",
|
||||||
|
"HelmChartConfig.helm.cattle.io/v1")...)
|
||||||
|
|
||||||
return factory.BatchWait()
|
return factory.BatchWait()
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,6 +170,7 @@ func masterControllers(ctx context.Context, sc *Context, config *Config) error {
|
||||||
|
|
||||||
helm.Register(ctx, sc.Apply,
|
helm.Register(ctx, sc.Apply,
|
||||||
sc.Helm.Helm().V1().HelmChart(),
|
sc.Helm.Helm().V1().HelmChart(),
|
||||||
|
sc.Helm.Helm().V1().HelmChartConfig(),
|
||||||
sc.Batch.Batch().V1().Job(),
|
sc.Batch.Batch().V1().Job(),
|
||||||
sc.Auth.Rbac().V1().ClusterRoleBinding(),
|
sc.Auth.Rbac().V1().ClusterRoleBinding(),
|
||||||
sc.Core.Core().V1().ServiceAccount(),
|
sc.Core.Core().V1().ServiceAccount(),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
docker.io/rancher/coredns-coredns:1.6.9
|
docker.io/rancher/coredns-coredns:1.6.9
|
||||||
docker.io/rancher/klipper-helm:v0.2.7
|
docker.io/rancher/klipper-helm:v0.3.0
|
||||||
docker.io/rancher/klipper-lb:v0.1.2
|
docker.io/rancher/klipper-lb:v0.1.2
|
||||||
docker.io/rancher/library-traefik:1.7.19
|
docker.io/rancher/library-traefik:1.7.19
|
||||||
docker.io/rancher/local-path-provisioner:v0.0.14
|
docker.io/rancher/local-path-provisioner:v0.0.14
|
||||||
|
|
|
@ -31,3 +31,17 @@ type HelmChartSpec struct {
|
||||||
type HelmChartStatus struct {
|
type HelmChartStatus struct {
|
||||||
JobName string `json:"jobName,omitempty"`
|
JobName string `json:"jobName,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// +genclient
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
type HelmChartConfig struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
|
Spec HelmChartConfigSpec `json:"spec,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type HelmChartConfigSpec struct {
|
||||||
|
ValuesContent string `json:"valuesContent,omitempty"`
|
||||||
|
}
|
||||||
|
|
|
@ -53,6 +53,82 @@ func (in *HelmChart) DeepCopyObject() runtime.Object {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *HelmChartConfig) DeepCopyInto(out *HelmChartConfig) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
|
out.Spec = in.Spec
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartConfig.
|
||||||
|
func (in *HelmChartConfig) DeepCopy() *HelmChartConfig {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(HelmChartConfig)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *HelmChartConfig) DeepCopyObject() runtime.Object {
|
||||||
|
if c := in.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *HelmChartConfigList) DeepCopyInto(out *HelmChartConfigList) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||||
|
if in.Items != nil {
|
||||||
|
in, out := &in.Items, &out.Items
|
||||||
|
*out = make([]HelmChartConfig, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartConfigList.
|
||||||
|
func (in *HelmChartConfigList) DeepCopy() *HelmChartConfigList {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(HelmChartConfigList)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *HelmChartConfigList) DeepCopyObject() runtime.Object {
|
||||||
|
if c := in.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *HelmChartConfigSpec) DeepCopyInto(out *HelmChartConfigSpec) {
|
||||||
|
*out = *in
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartConfigSpec.
|
||||||
|
func (in *HelmChartConfigSpec) DeepCopy() *HelmChartConfigSpec {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(HelmChartConfigSpec)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *HelmChartList) DeepCopyInto(out *HelmChartList) {
|
func (in *HelmChartList) DeepCopyInto(out *HelmChartList) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
|
@ -40,3 +40,20 @@ func NewHelmChart(namespace, name string, obj HelmChart) *HelmChart {
|
||||||
obj.Namespace = namespace
|
obj.Namespace = namespace
|
||||||
return &obj
|
return &obj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// HelmChartConfigList is a list of HelmChartConfig resources
|
||||||
|
type HelmChartConfigList struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
metav1.ListMeta `json:"metadata"`
|
||||||
|
|
||||||
|
Items []HelmChartConfig `json:"items"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewHelmChartConfig(namespace, name string, obj HelmChartConfig) *HelmChartConfig {
|
||||||
|
obj.APIVersion, obj.Kind = SchemeGroupVersion.WithKind("HelmChartConfig").ToAPIVersionAndKind()
|
||||||
|
obj.Name = name
|
||||||
|
obj.Namespace = namespace
|
||||||
|
return &obj
|
||||||
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
HelmChartResourceName = "helmcharts"
|
HelmChartResourceName = "helmcharts"
|
||||||
|
HelmChartConfigResourceName = "helmchartconfigs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SchemeGroupVersion is group version used to register these objects
|
// SchemeGroupVersion is group version used to register these objects
|
||||||
|
@ -54,6 +55,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
&HelmChart{},
|
&HelmChart{},
|
||||||
&HelmChartList{},
|
&HelmChartList{},
|
||||||
|
&HelmChartConfig{},
|
||||||
|
&HelmChartConfigList{},
|
||||||
)
|
)
|
||||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -19,3 +19,5 @@ limitations under the License.
|
||||||
package v1
|
package v1
|
||||||
|
|
||||||
type HelmChartExpansion interface{}
|
type HelmChartExpansion interface{}
|
||||||
|
|
||||||
|
type HelmChartConfigExpansion interface{}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import (
|
||||||
type HelmV1Interface interface {
|
type HelmV1Interface interface {
|
||||||
RESTClient() rest.Interface
|
RESTClient() rest.Interface
|
||||||
HelmChartsGetter
|
HelmChartsGetter
|
||||||
|
HelmChartConfigsGetter
|
||||||
}
|
}
|
||||||
|
|
||||||
// HelmV1Client is used to interact with features provided by the helm.cattle.io group.
|
// HelmV1Client is used to interact with features provided by the helm.cattle.io group.
|
||||||
|
@ -38,6 +39,10 @@ func (c *HelmV1Client) HelmCharts(namespace string) HelmChartInterface {
|
||||||
return newHelmCharts(c, namespace)
|
return newHelmCharts(c, namespace)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *HelmV1Client) HelmChartConfigs(namespace string) HelmChartConfigInterface {
|
||||||
|
return newHelmChartConfigs(c, namespace)
|
||||||
|
}
|
||||||
|
|
||||||
// NewForConfig creates a new HelmV1Client for the given config.
|
// NewForConfig creates a new HelmV1Client for the given config.
|
||||||
func NewForConfig(c *rest.Config) (*HelmV1Client, error) {
|
func NewForConfig(c *rest.Config) (*HelmV1Client, error) {
|
||||||
config := *c
|
config := *c
|
||||||
|
|
178
vendor/github.com/rancher/helm-controller/pkg/generated/clientset/versioned/typed/helm.cattle.io/v1/helmchartconfig.go
generated
vendored
Normal file
178
vendor/github.com/rancher/helm-controller/pkg/generated/clientset/versioned/typed/helm.cattle.io/v1/helmchartconfig.go
generated
vendored
Normal file
|
@ -0,0 +1,178 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by main. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
v1 "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1"
|
||||||
|
scheme "github.com/rancher/helm-controller/pkg/generated/clientset/versioned/scheme"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HelmChartConfigsGetter has a method to return a HelmChartConfigInterface.
|
||||||
|
// A group's client should implement this interface.
|
||||||
|
type HelmChartConfigsGetter interface {
|
||||||
|
HelmChartConfigs(namespace string) HelmChartConfigInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
// HelmChartConfigInterface has methods to work with HelmChartConfig resources.
|
||||||
|
type HelmChartConfigInterface interface {
|
||||||
|
Create(ctx context.Context, helmChartConfig *v1.HelmChartConfig, opts metav1.CreateOptions) (*v1.HelmChartConfig, error)
|
||||||
|
Update(ctx context.Context, helmChartConfig *v1.HelmChartConfig, opts metav1.UpdateOptions) (*v1.HelmChartConfig, error)
|
||||||
|
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||||
|
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||||
|
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.HelmChartConfig, error)
|
||||||
|
List(ctx context.Context, opts metav1.ListOptions) (*v1.HelmChartConfigList, error)
|
||||||
|
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||||
|
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HelmChartConfig, err error)
|
||||||
|
HelmChartConfigExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// helmChartConfigs implements HelmChartConfigInterface
|
||||||
|
type helmChartConfigs struct {
|
||||||
|
client rest.Interface
|
||||||
|
ns string
|
||||||
|
}
|
||||||
|
|
||||||
|
// newHelmChartConfigs returns a HelmChartConfigs
|
||||||
|
func newHelmChartConfigs(c *HelmV1Client, namespace string) *helmChartConfigs {
|
||||||
|
return &helmChartConfigs{
|
||||||
|
client: c.RESTClient(),
|
||||||
|
ns: namespace,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get takes name of the helmChartConfig, and returns the corresponding helmChartConfig object, and an error if there is any.
|
||||||
|
func (c *helmChartConfigs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.HelmChartConfig, err error) {
|
||||||
|
result = &v1.HelmChartConfig{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("helmchartconfigs").
|
||||||
|
Name(name).
|
||||||
|
VersionedParams(&options, scheme.ParameterCodec).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List takes label and field selectors, and returns the list of HelmChartConfigs that match those selectors.
|
||||||
|
func (c *helmChartConfigs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.HelmChartConfigList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
|
result = &v1.HelmChartConfigList{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("helmchartconfigs").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch returns a watch.Interface that watches the requested helmChartConfigs.
|
||||||
|
func (c *helmChartConfigs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
|
opts.Watch = true
|
||||||
|
return c.client.Get().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("helmchartconfigs").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
|
Watch(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create takes the representation of a helmChartConfig and creates it. Returns the server's representation of the helmChartConfig, and an error, if there is any.
|
||||||
|
func (c *helmChartConfigs) Create(ctx context.Context, helmChartConfig *v1.HelmChartConfig, opts metav1.CreateOptions) (result *v1.HelmChartConfig, err error) {
|
||||||
|
result = &v1.HelmChartConfig{}
|
||||||
|
err = c.client.Post().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("helmchartconfigs").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Body(helmChartConfig).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update takes the representation of a helmChartConfig and updates it. Returns the server's representation of the helmChartConfig, and an error, if there is any.
|
||||||
|
func (c *helmChartConfigs) Update(ctx context.Context, helmChartConfig *v1.HelmChartConfig, opts metav1.UpdateOptions) (result *v1.HelmChartConfig, err error) {
|
||||||
|
result = &v1.HelmChartConfig{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("helmchartconfigs").
|
||||||
|
Name(helmChartConfig.Name).
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Body(helmChartConfig).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete takes name of the helmChartConfig and deletes it. Returns an error if one occurs.
|
||||||
|
func (c *helmChartConfigs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||||
|
return c.client.Delete().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("helmchartconfigs").
|
||||||
|
Name(name).
|
||||||
|
Body(&opts).
|
||||||
|
Do(ctx).
|
||||||
|
Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCollection deletes a collection of objects.
|
||||||
|
func (c *helmChartConfigs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOpts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
|
return c.client.Delete().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("helmchartconfigs").
|
||||||
|
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
|
Body(&opts).
|
||||||
|
Do(ctx).
|
||||||
|
Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched helmChartConfig.
|
||||||
|
func (c *helmChartConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HelmChartConfig, err error) {
|
||||||
|
result = &v1.HelmChartConfig{}
|
||||||
|
err = c.client.Patch(pt).
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("helmchartconfigs").
|
||||||
|
Name(name).
|
||||||
|
SubResource(subresources...).
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Body(data).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
237
vendor/github.com/rancher/helm-controller/pkg/generated/controllers/helm.cattle.io/v1/helmchartconfig.go
generated
vendored
Normal file
237
vendor/github.com/rancher/helm-controller/pkg/generated/controllers/helm.cattle.io/v1/helmchartconfig.go
generated
vendored
Normal file
|
@ -0,0 +1,237 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by main. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
v1 "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1"
|
||||||
|
clientset "github.com/rancher/helm-controller/pkg/generated/clientset/versioned/typed/helm.cattle.io/v1"
|
||||||
|
informers "github.com/rancher/helm-controller/pkg/generated/informers/externalversions/helm.cattle.io/v1"
|
||||||
|
listers "github.com/rancher/helm-controller/pkg/generated/listers/helm.cattle.io/v1"
|
||||||
|
"github.com/rancher/wrangler/pkg/generic"
|
||||||
|
"k8s.io/apimachinery/pkg/api/equality"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/watch"
|
||||||
|
"k8s.io/client-go/tools/cache"
|
||||||
|
)
|
||||||
|
|
||||||
|
type HelmChartConfigHandler func(string, *v1.HelmChartConfig) (*v1.HelmChartConfig, error)
|
||||||
|
|
||||||
|
type HelmChartConfigController interface {
|
||||||
|
generic.ControllerMeta
|
||||||
|
HelmChartConfigClient
|
||||||
|
|
||||||
|
OnChange(ctx context.Context, name string, sync HelmChartConfigHandler)
|
||||||
|
OnRemove(ctx context.Context, name string, sync HelmChartConfigHandler)
|
||||||
|
Enqueue(namespace, name string)
|
||||||
|
EnqueueAfter(namespace, name string, duration time.Duration)
|
||||||
|
|
||||||
|
Cache() HelmChartConfigCache
|
||||||
|
}
|
||||||
|
|
||||||
|
type HelmChartConfigClient interface {
|
||||||
|
Create(*v1.HelmChartConfig) (*v1.HelmChartConfig, error)
|
||||||
|
Update(*v1.HelmChartConfig) (*v1.HelmChartConfig, error)
|
||||||
|
|
||||||
|
Delete(namespace, name string, options *metav1.DeleteOptions) error
|
||||||
|
Get(namespace, name string, options metav1.GetOptions) (*v1.HelmChartConfig, error)
|
||||||
|
List(namespace string, opts metav1.ListOptions) (*v1.HelmChartConfigList, error)
|
||||||
|
Watch(namespace string, opts metav1.ListOptions) (watch.Interface, error)
|
||||||
|
Patch(namespace, name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.HelmChartConfig, err error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type HelmChartConfigCache interface {
|
||||||
|
Get(namespace, name string) (*v1.HelmChartConfig, error)
|
||||||
|
List(namespace string, selector labels.Selector) ([]*v1.HelmChartConfig, error)
|
||||||
|
|
||||||
|
AddIndexer(indexName string, indexer HelmChartConfigIndexer)
|
||||||
|
GetByIndex(indexName, key string) ([]*v1.HelmChartConfig, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type HelmChartConfigIndexer func(obj *v1.HelmChartConfig) ([]string, error)
|
||||||
|
|
||||||
|
type helmChartConfigController struct {
|
||||||
|
controllerManager *generic.ControllerManager
|
||||||
|
clientGetter clientset.HelmChartConfigsGetter
|
||||||
|
informer informers.HelmChartConfigInformer
|
||||||
|
gvk schema.GroupVersionKind
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewHelmChartConfigController(gvk schema.GroupVersionKind, controllerManager *generic.ControllerManager, clientGetter clientset.HelmChartConfigsGetter, informer informers.HelmChartConfigInformer) HelmChartConfigController {
|
||||||
|
return &helmChartConfigController{
|
||||||
|
controllerManager: controllerManager,
|
||||||
|
clientGetter: clientGetter,
|
||||||
|
informer: informer,
|
||||||
|
gvk: gvk,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func FromHelmChartConfigHandlerToHandler(sync HelmChartConfigHandler) generic.Handler {
|
||||||
|
return func(key string, obj runtime.Object) (ret runtime.Object, err error) {
|
||||||
|
var v *v1.HelmChartConfig
|
||||||
|
if obj == nil {
|
||||||
|
v, err = sync(key, nil)
|
||||||
|
} else {
|
||||||
|
v, err = sync(key, obj.(*v1.HelmChartConfig))
|
||||||
|
}
|
||||||
|
if v == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return v, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigController) Updater() generic.Updater {
|
||||||
|
return func(obj runtime.Object) (runtime.Object, error) {
|
||||||
|
newObj, err := c.Update(obj.(*v1.HelmChartConfig))
|
||||||
|
if newObj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return newObj, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func UpdateHelmChartConfigDeepCopyOnChange(client HelmChartConfigClient, obj *v1.HelmChartConfig, handler func(obj *v1.HelmChartConfig) (*v1.HelmChartConfig, error)) (*v1.HelmChartConfig, error) {
|
||||||
|
if obj == nil {
|
||||||
|
return obj, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
copyObj := obj.DeepCopy()
|
||||||
|
newObj, err := handler(copyObj)
|
||||||
|
if newObj != nil {
|
||||||
|
copyObj = newObj
|
||||||
|
}
|
||||||
|
if obj.ResourceVersion == copyObj.ResourceVersion && !equality.Semantic.DeepEqual(obj, copyObj) {
|
||||||
|
return client.Update(copyObj)
|
||||||
|
}
|
||||||
|
|
||||||
|
return copyObj, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigController) AddGenericHandler(ctx context.Context, name string, handler generic.Handler) {
|
||||||
|
c.controllerManager.AddHandler(ctx, c.gvk, c.informer.Informer(), name, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigController) AddGenericRemoveHandler(ctx context.Context, name string, handler generic.Handler) {
|
||||||
|
removeHandler := generic.NewRemoveHandler(name, c.Updater(), handler)
|
||||||
|
c.controllerManager.AddHandler(ctx, c.gvk, c.informer.Informer(), name, removeHandler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigController) OnChange(ctx context.Context, name string, sync HelmChartConfigHandler) {
|
||||||
|
c.AddGenericHandler(ctx, name, FromHelmChartConfigHandlerToHandler(sync))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigController) OnRemove(ctx context.Context, name string, sync HelmChartConfigHandler) {
|
||||||
|
removeHandler := generic.NewRemoveHandler(name, c.Updater(), FromHelmChartConfigHandlerToHandler(sync))
|
||||||
|
c.AddGenericHandler(ctx, name, removeHandler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigController) Enqueue(namespace, name string) {
|
||||||
|
c.controllerManager.Enqueue(c.gvk, c.informer.Informer(), namespace, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigController) EnqueueAfter(namespace, name string, duration time.Duration) {
|
||||||
|
c.controllerManager.EnqueueAfter(c.gvk, c.informer.Informer(), namespace, name, duration)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigController) Informer() cache.SharedIndexInformer {
|
||||||
|
return c.informer.Informer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigController) GroupVersionKind() schema.GroupVersionKind {
|
||||||
|
return c.gvk
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigController) Cache() HelmChartConfigCache {
|
||||||
|
return &helmChartConfigCache{
|
||||||
|
lister: c.informer.Lister(),
|
||||||
|
indexer: c.informer.Informer().GetIndexer(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigController) Create(obj *v1.HelmChartConfig) (*v1.HelmChartConfig, error) {
|
||||||
|
return c.clientGetter.HelmChartConfigs(obj.Namespace).Create(context.TODO(), obj, metav1.CreateOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigController) Update(obj *v1.HelmChartConfig) (*v1.HelmChartConfig, error) {
|
||||||
|
return c.clientGetter.HelmChartConfigs(obj.Namespace).Update(context.TODO(), obj, metav1.UpdateOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigController) Delete(namespace, name string, options *metav1.DeleteOptions) error {
|
||||||
|
if options == nil {
|
||||||
|
options = &metav1.DeleteOptions{}
|
||||||
|
}
|
||||||
|
return c.clientGetter.HelmChartConfigs(namespace).Delete(context.TODO(), name, *options)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigController) Get(namespace, name string, options metav1.GetOptions) (*v1.HelmChartConfig, error) {
|
||||||
|
return c.clientGetter.HelmChartConfigs(namespace).Get(context.TODO(), name, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigController) List(namespace string, opts metav1.ListOptions) (*v1.HelmChartConfigList, error) {
|
||||||
|
return c.clientGetter.HelmChartConfigs(namespace).List(context.TODO(), opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigController) Watch(namespace string, opts metav1.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.clientGetter.HelmChartConfigs(namespace).Watch(context.TODO(), opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigController) Patch(namespace, name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.HelmChartConfig, err error) {
|
||||||
|
return c.clientGetter.HelmChartConfigs(namespace).Patch(context.TODO(), name, pt, data, metav1.PatchOptions{}, subresources...)
|
||||||
|
}
|
||||||
|
|
||||||
|
type helmChartConfigCache struct {
|
||||||
|
lister listers.HelmChartConfigLister
|
||||||
|
indexer cache.Indexer
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigCache) Get(namespace, name string) (*v1.HelmChartConfig, error) {
|
||||||
|
return c.lister.HelmChartConfigs(namespace).Get(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigCache) List(namespace string, selector labels.Selector) ([]*v1.HelmChartConfig, error) {
|
||||||
|
return c.lister.HelmChartConfigs(namespace).List(selector)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigCache) AddIndexer(indexName string, indexer HelmChartConfigIndexer) {
|
||||||
|
utilruntime.Must(c.indexer.AddIndexers(map[string]cache.IndexFunc{
|
||||||
|
indexName: func(obj interface{}) (strings []string, e error) {
|
||||||
|
return indexer(obj.(*v1.HelmChartConfig))
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *helmChartConfigCache) GetByIndex(indexName, key string) (result []*v1.HelmChartConfig, err error) {
|
||||||
|
objs, err := c.indexer.ByIndex(indexName, key)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
result = make([]*v1.HelmChartConfig, 0, len(objs))
|
||||||
|
for _, obj := range objs {
|
||||||
|
result = append(result, obj.(*v1.HelmChartConfig))
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
|
@ -27,6 +27,7 @@ import (
|
||||||
|
|
||||||
type Interface interface {
|
type Interface interface {
|
||||||
HelmChart() HelmChartController
|
HelmChart() HelmChartController
|
||||||
|
HelmChartConfig() HelmChartConfigController
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(controllerManager *generic.ControllerManager, client clientset.HelmV1Interface,
|
func New(controllerManager *generic.ControllerManager, client clientset.HelmV1Interface,
|
||||||
|
@ -47,3 +48,6 @@ type version struct {
|
||||||
func (c *version) HelmChart() HelmChartController {
|
func (c *version) HelmChart() HelmChartController {
|
||||||
return NewHelmChartController(v1.SchemeGroupVersion.WithKind("HelmChart"), c.controllerManager, c.client, c.informers.HelmCharts())
|
return NewHelmChartController(v1.SchemeGroupVersion.WithKind("HelmChart"), c.controllerManager, c.client, c.informers.HelmCharts())
|
||||||
}
|
}
|
||||||
|
func (c *version) HelmChartConfig() HelmChartConfigController {
|
||||||
|
return NewHelmChartConfigController(v1.SchemeGroupVersion.WithKind("HelmChartConfig"), c.controllerManager, c.client, c.informers.HelmChartConfigs())
|
||||||
|
}
|
||||||
|
|
|
@ -55,6 +55,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
||||||
// Group=helm.cattle.io, Version=v1
|
// Group=helm.cattle.io, Version=v1
|
||||||
case v1.SchemeGroupVersion.WithResource("helmcharts"):
|
case v1.SchemeGroupVersion.WithResource("helmcharts"):
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Helm().V1().HelmCharts().Informer()}, nil
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Helm().V1().HelmCharts().Informer()}, nil
|
||||||
|
case v1.SchemeGroupVersion.WithResource("helmchartconfigs"):
|
||||||
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Helm().V1().HelmChartConfigs().Informer()}, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
90
vendor/github.com/rancher/helm-controller/pkg/generated/informers/externalversions/helm.cattle.io/v1/helmchartconfig.go
generated
vendored
Normal file
90
vendor/github.com/rancher/helm-controller/pkg/generated/informers/externalversions/helm.cattle.io/v1/helmchartconfig.go
generated
vendored
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by main. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
time "time"
|
||||||
|
|
||||||
|
helmcattleiov1 "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1"
|
||||||
|
versioned "github.com/rancher/helm-controller/pkg/generated/clientset/versioned"
|
||||||
|
internalinterfaces "github.com/rancher/helm-controller/pkg/generated/informers/externalversions/internalinterfaces"
|
||||||
|
v1 "github.com/rancher/helm-controller/pkg/generated/listers/helm.cattle.io/v1"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
cache "k8s.io/client-go/tools/cache"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HelmChartConfigInformer provides access to a shared informer and lister for
|
||||||
|
// HelmChartConfigs.
|
||||||
|
type HelmChartConfigInformer interface {
|
||||||
|
Informer() cache.SharedIndexInformer
|
||||||
|
Lister() v1.HelmChartConfigLister
|
||||||
|
}
|
||||||
|
|
||||||
|
type helmChartConfigInformer struct {
|
||||||
|
factory internalinterfaces.SharedInformerFactory
|
||||||
|
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||||
|
namespace string
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewHelmChartConfigInformer constructs a new informer for HelmChartConfig type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewHelmChartConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredHelmChartConfigInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewFilteredHelmChartConfigInformer constructs a new informer for HelmChartConfig type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewFilteredHelmChartConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||||
|
return cache.NewSharedIndexInformer(
|
||||||
|
&cache.ListWatch{
|
||||||
|
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.HelmV1().HelmChartConfigs(namespace).List(context.TODO(), options)
|
||||||
|
},
|
||||||
|
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.HelmV1().HelmChartConfigs(namespace).Watch(context.TODO(), options)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
&helmcattleiov1.HelmChartConfig{},
|
||||||
|
resyncPeriod,
|
||||||
|
indexers,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *helmChartConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredHelmChartConfigInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *helmChartConfigInformer) Informer() cache.SharedIndexInformer {
|
||||||
|
return f.factory.InformerFor(&helmcattleiov1.HelmChartConfig{}, f.defaultInformer)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *helmChartConfigInformer) Lister() v1.HelmChartConfigLister {
|
||||||
|
return v1.NewHelmChartConfigLister(f.Informer().GetIndexer())
|
||||||
|
}
|
|
@ -26,6 +26,8 @@ import (
|
||||||
type Interface interface {
|
type Interface interface {
|
||||||
// HelmCharts returns a HelmChartInformer.
|
// HelmCharts returns a HelmChartInformer.
|
||||||
HelmCharts() HelmChartInformer
|
HelmCharts() HelmChartInformer
|
||||||
|
// HelmChartConfigs returns a HelmChartConfigInformer.
|
||||||
|
HelmChartConfigs() HelmChartConfigInformer
|
||||||
}
|
}
|
||||||
|
|
||||||
type version struct {
|
type version struct {
|
||||||
|
@ -43,3 +45,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
|
||||||
func (v *version) HelmCharts() HelmChartInformer {
|
func (v *version) HelmCharts() HelmChartInformer {
|
||||||
return &helmChartInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
return &helmChartInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HelmChartConfigs returns a HelmChartConfigInformer.
|
||||||
|
func (v *version) HelmChartConfigs() HelmChartConfigInformer {
|
||||||
|
return &helmChartConfigInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||||
|
}
|
||||||
|
|
|
@ -25,3 +25,11 @@ type HelmChartListerExpansion interface{}
|
||||||
// HelmChartNamespaceListerExpansion allows custom methods to be added to
|
// HelmChartNamespaceListerExpansion allows custom methods to be added to
|
||||||
// HelmChartNamespaceLister.
|
// HelmChartNamespaceLister.
|
||||||
type HelmChartNamespaceListerExpansion interface{}
|
type HelmChartNamespaceListerExpansion interface{}
|
||||||
|
|
||||||
|
// HelmChartConfigListerExpansion allows custom methods to be added to
|
||||||
|
// HelmChartConfigLister.
|
||||||
|
type HelmChartConfigListerExpansion interface{}
|
||||||
|
|
||||||
|
// HelmChartConfigNamespaceListerExpansion allows custom methods to be added to
|
||||||
|
// HelmChartConfigNamespaceLister.
|
||||||
|
type HelmChartConfigNamespaceListerExpansion interface{}
|
||||||
|
|
94
vendor/github.com/rancher/helm-controller/pkg/generated/listers/helm.cattle.io/v1/helmchartconfig.go
generated
vendored
Normal file
94
vendor/github.com/rancher/helm-controller/pkg/generated/listers/helm.cattle.io/v1/helmchartconfig.go
generated
vendored
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by main. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1 "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
|
"k8s.io/client-go/tools/cache"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HelmChartConfigLister helps list HelmChartConfigs.
|
||||||
|
type HelmChartConfigLister interface {
|
||||||
|
// List lists all HelmChartConfigs in the indexer.
|
||||||
|
List(selector labels.Selector) (ret []*v1.HelmChartConfig, err error)
|
||||||
|
// HelmChartConfigs returns an object that can list and get HelmChartConfigs.
|
||||||
|
HelmChartConfigs(namespace string) HelmChartConfigNamespaceLister
|
||||||
|
HelmChartConfigListerExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// helmChartConfigLister implements the HelmChartConfigLister interface.
|
||||||
|
type helmChartConfigLister struct {
|
||||||
|
indexer cache.Indexer
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewHelmChartConfigLister returns a new HelmChartConfigLister.
|
||||||
|
func NewHelmChartConfigLister(indexer cache.Indexer) HelmChartConfigLister {
|
||||||
|
return &helmChartConfigLister{indexer: indexer}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List lists all HelmChartConfigs in the indexer.
|
||||||
|
func (s *helmChartConfigLister) List(selector labels.Selector) (ret []*v1.HelmChartConfig, err error) {
|
||||||
|
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||||
|
ret = append(ret, m.(*v1.HelmChartConfig))
|
||||||
|
})
|
||||||
|
return ret, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// HelmChartConfigs returns an object that can list and get HelmChartConfigs.
|
||||||
|
func (s *helmChartConfigLister) HelmChartConfigs(namespace string) HelmChartConfigNamespaceLister {
|
||||||
|
return helmChartConfigNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||||
|
}
|
||||||
|
|
||||||
|
// HelmChartConfigNamespaceLister helps list and get HelmChartConfigs.
|
||||||
|
type HelmChartConfigNamespaceLister interface {
|
||||||
|
// List lists all HelmChartConfigs in the indexer for a given namespace.
|
||||||
|
List(selector labels.Selector) (ret []*v1.HelmChartConfig, err error)
|
||||||
|
// Get retrieves the HelmChartConfig from the indexer for a given namespace and name.
|
||||||
|
Get(name string) (*v1.HelmChartConfig, error)
|
||||||
|
HelmChartConfigNamespaceListerExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// helmChartConfigNamespaceLister implements the HelmChartConfigNamespaceLister
|
||||||
|
// interface.
|
||||||
|
type helmChartConfigNamespaceLister struct {
|
||||||
|
indexer cache.Indexer
|
||||||
|
namespace string
|
||||||
|
}
|
||||||
|
|
||||||
|
// List lists all HelmChartConfigs in the indexer for a given namespace.
|
||||||
|
func (s helmChartConfigNamespaceLister) List(selector labels.Selector) (ret []*v1.HelmChartConfig, err error) {
|
||||||
|
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||||
|
ret = append(ret, m.(*v1.HelmChartConfig))
|
||||||
|
})
|
||||||
|
return ret, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get retrieves the HelmChartConfig from the indexer for a given namespace and name.
|
||||||
|
func (s helmChartConfigNamespaceLister) Get(name string) (*v1.HelmChartConfig, error) {
|
||||||
|
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if !exists {
|
||||||
|
return nil, errors.NewNotFound(v1.Resource("helmchartconfig"), name)
|
||||||
|
}
|
||||||
|
return obj.(*v1.HelmChartConfig), nil
|
||||||
|
}
|
|
@ -3,7 +3,6 @@ package helm
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/hex"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
|
@ -33,25 +32,29 @@ var (
|
||||||
type Controller struct {
|
type Controller struct {
|
||||||
namespace string
|
namespace string
|
||||||
helmController helmcontroller.HelmChartController
|
helmController helmcontroller.HelmChartController
|
||||||
|
confController helmcontroller.HelmChartConfigController
|
||||||
jobsCache batchcontroller.JobCache
|
jobsCache batchcontroller.JobCache
|
||||||
apply apply.Apply
|
apply apply.Apply
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
image = "rancher/klipper-helm:v0.2.7"
|
image = "rancher/klipper-helm:v0.3.0"
|
||||||
Label = "helmcharts.helm.cattle.io/chart"
|
Label = "helmcharts.helm.cattle.io/chart"
|
||||||
|
Annotation = "helmcharts.helm.cattle.io/configHash"
|
||||||
CRDName = "helmcharts.helm.cattle.io"
|
CRDName = "helmcharts.helm.cattle.io"
|
||||||
|
ConfigCRDName = "helmchartconfigs.helm.cattle.io"
|
||||||
Name = "helm-controller"
|
Name = "helm-controller"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Register(ctx context.Context, apply apply.Apply,
|
func Register(ctx context.Context, apply apply.Apply,
|
||||||
helms helmcontroller.HelmChartController,
|
helms helmcontroller.HelmChartController,
|
||||||
|
confs helmcontroller.HelmChartConfigController,
|
||||||
jobs batchcontroller.JobController,
|
jobs batchcontroller.JobController,
|
||||||
crbs rbaccontroller.ClusterRoleBindingController,
|
crbs rbaccontroller.ClusterRoleBindingController,
|
||||||
sas corecontroller.ServiceAccountController,
|
sas corecontroller.ServiceAccountController,
|
||||||
cm corecontroller.ConfigMapController) {
|
cm corecontroller.ConfigMapController) {
|
||||||
apply = apply.WithSetID(Name).
|
apply = apply.WithSetID(Name).
|
||||||
WithCacheTypes(helms, jobs, crbs, sas, cm).
|
WithCacheTypes(helms, confs, jobs, crbs, sas, cm).
|
||||||
WithStrictCaching().WithPatcher(batch.SchemeGroupVersion.WithKind("Job"), func(namespace, name string, pt types.PatchType, data []byte) (runtime.Object, error) {
|
WithStrictCaching().WithPatcher(batch.SchemeGroupVersion.WithKind("Job"), func(namespace, name string, pt types.PatchType, data []byte) (runtime.Object, error) {
|
||||||
err := jobs.Delete(namespace, name, &meta.DeleteOptions{})
|
err := jobs.Delete(namespace, name, &meta.DeleteOptions{})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -76,23 +79,25 @@ func Register(ctx context.Context, apply apply.Apply,
|
||||||
return nil, nil
|
return nil, nil
|
||||||
},
|
},
|
||||||
helms,
|
helms,
|
||||||
|
confs,
|
||||||
jobs)
|
jobs)
|
||||||
|
|
||||||
controller := &Controller{
|
controller := &Controller{
|
||||||
helmController: helms,
|
helmController: helms,
|
||||||
|
confController: confs,
|
||||||
jobsCache: jobs.Cache(),
|
jobsCache: jobs.Cache(),
|
||||||
apply: apply,
|
apply: apply,
|
||||||
}
|
}
|
||||||
|
|
||||||
helms.OnChange(ctx, Name, controller.OnHelmChanged)
|
helms.OnChange(ctx, Name, controller.OnHelmChange)
|
||||||
helms.OnRemove(ctx, Name, controller.OnHelmRemove)
|
helms.OnRemove(ctx, Name, controller.OnHelmRemove)
|
||||||
|
confs.OnChange(ctx, Name, controller.OnConfChange)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) OnHelmChanged(key string, chart *helmv1.HelmChart) (*helmv1.HelmChart, error) {
|
func (c *Controller) OnHelmChange(key string, chart *helmv1.HelmChart) (*helmv1.HelmChart, error) {
|
||||||
if chart == nil {
|
if chart == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if chart.Spec.Chart == "" && chart.Spec.ChartContent == "" {
|
if chart.Spec.Chart == "" && chart.Spec.ChartContent == "" {
|
||||||
return chart, nil
|
return chart, nil
|
||||||
}
|
}
|
||||||
|
@ -101,13 +106,20 @@ func (c *Controller) OnHelmChanged(key string, chart *helmv1.HelmChart) (*helmv1
|
||||||
job, valuesConfigMap, contentConfigMap := job(chart)
|
job, valuesConfigMap, contentConfigMap := job(chart)
|
||||||
objs.Add(serviceAccount(chart))
|
objs.Add(serviceAccount(chart))
|
||||||
objs.Add(roleBinding(chart))
|
objs.Add(roleBinding(chart))
|
||||||
objs.Add(job)
|
|
||||||
if valuesConfigMap != nil {
|
if config, err := c.confController.Cache().Get(chart.Namespace, chart.Name); err != nil {
|
||||||
objs.Add(valuesConfigMap)
|
if !errors.IsNotFound(err) {
|
||||||
|
return chart, err
|
||||||
}
|
}
|
||||||
if contentConfigMap != nil {
|
} else if config != nil {
|
||||||
|
valuesConfigMapAddConfig(valuesConfigMap, config)
|
||||||
|
}
|
||||||
|
|
||||||
|
hashConfigMaps(job, contentConfigMap, valuesConfigMap)
|
||||||
|
|
||||||
objs.Add(contentConfigMap)
|
objs.Add(contentConfigMap)
|
||||||
}
|
objs.Add(valuesConfigMap)
|
||||||
|
objs.Add(job)
|
||||||
|
|
||||||
if err := c.apply.WithOwner(chart).Apply(objs); err != nil {
|
if err := c.apply.WithOwner(chart).Apply(objs); err != nil {
|
||||||
return chart, err
|
return chart, err
|
||||||
|
@ -119,14 +131,18 @@ func (c *Controller) OnHelmChanged(key string, chart *helmv1.HelmChart) (*helmv1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) OnHelmRemove(key string, chart *helmv1.HelmChart) (*helmv1.HelmChart, error) {
|
func (c *Controller) OnHelmRemove(key string, chart *helmv1.HelmChart) (*helmv1.HelmChart, error) {
|
||||||
|
if chart == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
if chart.Spec.Chart == "" {
|
if chart.Spec.Chart == "" {
|
||||||
return chart, nil
|
return chart, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
job, _, _ := job(chart)
|
job, _, _ := job(chart)
|
||||||
job, err := c.jobsCache.Get(chart.Namespace, job.Name)
|
job, err := c.jobsCache.Get(chart.Namespace, job.Name)
|
||||||
|
|
||||||
if errors.IsNotFound(err) {
|
if errors.IsNotFound(err) {
|
||||||
_, err := c.OnHelmChanged(key, chart)
|
_, err := c.OnHelmChange(key, chart)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return chart, err
|
return chart, err
|
||||||
}
|
}
|
||||||
|
@ -135,7 +151,7 @@ func (c *Controller) OnHelmRemove(key string, chart *helmv1.HelmChart) (*helmv1.
|
||||||
}
|
}
|
||||||
|
|
||||||
if job.Status.Succeeded <= 0 {
|
if job.Status.Succeeded <= 0 {
|
||||||
return chart, fmt.Errorf("waiting for delete of helm chart %s", chart.Name)
|
return chart, fmt.Errorf("waiting for delete of helm chart for %s by %s", key, job.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
chartCopy := chart.DeepCopy()
|
chartCopy := chart.DeepCopy()
|
||||||
|
@ -149,9 +165,23 @@ func (c *Controller) OnHelmRemove(key string, chart *helmv1.HelmChart) (*helmv1.
|
||||||
return newChart, c.apply.WithOwner(newChart).Apply(objectset.NewObjectSet())
|
return newChart, c.apply.WithOwner(newChart).Apply(objectset.NewObjectSet())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Controller) OnConfChange(key string, conf *helmv1.HelmChartConfig) (*helmv1.HelmChartConfig, error) {
|
||||||
|
if conf == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if chart, err := c.helmController.Cache().Get(conf.Namespace, conf.Name); err != nil {
|
||||||
|
if !errors.IsNotFound(err) {
|
||||||
|
return conf, err
|
||||||
|
}
|
||||||
|
} else if chart != nil {
|
||||||
|
c.helmController.Enqueue(conf.Namespace, conf.Name)
|
||||||
|
}
|
||||||
|
return conf, nil
|
||||||
|
}
|
||||||
|
|
||||||
func job(chart *helmv1.HelmChart) (*batch.Job, *core.ConfigMap, *core.ConfigMap) {
|
func job(chart *helmv1.HelmChart) (*batch.Job, *core.ConfigMap, *core.ConfigMap) {
|
||||||
oneThousand := int32(1000)
|
oneThousand := int32(1000)
|
||||||
valuesHash := sha256.Sum256([]byte(chart.Spec.ValuesContent))
|
|
||||||
|
|
||||||
action := "install"
|
action := "install"
|
||||||
if chart.DeletionTimestamp != nil {
|
if chart.DeletionTimestamp != nil {
|
||||||
|
@ -174,6 +204,7 @@ func job(chart *helmv1.HelmChart) (*batch.Job, *core.ConfigMap, *core.ConfigMap)
|
||||||
BackoffLimit: &oneThousand,
|
BackoffLimit: &oneThousand,
|
||||||
Template: core.PodTemplateSpec{
|
Template: core.PodTemplateSpec{
|
||||||
ObjectMeta: meta.ObjectMeta{
|
ObjectMeta: meta.ObjectMeta{
|
||||||
|
Annotations: map[string]string{},
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
Label: chart.Name,
|
Label: chart.Name,
|
||||||
},
|
},
|
||||||
|
@ -199,10 +230,6 @@ func job(chart *helmv1.HelmChart) (*batch.Job, *core.ConfigMap, *core.ConfigMap)
|
||||||
Name: "REPO",
|
Name: "REPO",
|
||||||
Value: chart.Spec.Repo,
|
Value: chart.Spec.Repo,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Name: "VALUES_HASH",
|
|
||||||
Value: hex.EncodeToString(valuesHash[:]),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Name: "HELM_DRIVER",
|
Name: "HELM_DRIVER",
|
||||||
Value: "secret",
|
Value: "secret",
|
||||||
|
@ -262,11 +289,7 @@ func job(chart *helmv1.HelmChart) (*batch.Job, *core.ConfigMap, *core.ConfigMap)
|
||||||
}
|
}
|
||||||
|
|
||||||
func valuesConfigMap(chart *helmv1.HelmChart) *core.ConfigMap {
|
func valuesConfigMap(chart *helmv1.HelmChart) *core.ConfigMap {
|
||||||
if chart.Spec.ValuesContent == "" {
|
var configMap = &core.ConfigMap{
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return &core.ConfigMap{
|
|
||||||
TypeMeta: meta.TypeMeta{
|
TypeMeta: meta.TypeMeta{
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Kind: "ConfigMap",
|
Kind: "ConfigMap",
|
||||||
|
@ -275,9 +298,19 @@ func valuesConfigMap(chart *helmv1.HelmChart) *core.ConfigMap {
|
||||||
Name: fmt.Sprintf("chart-values-%s", chart.Name),
|
Name: fmt.Sprintf("chart-values-%s", chart.Name),
|
||||||
Namespace: chart.Namespace,
|
Namespace: chart.Namespace,
|
||||||
},
|
},
|
||||||
Data: map[string]string{
|
Data: map[string]string{},
|
||||||
"values.yaml": chart.Spec.ValuesContent,
|
}
|
||||||
},
|
|
||||||
|
if chart.Spec.ValuesContent != "" {
|
||||||
|
configMap.Data["values-01_HelmChart.yaml"] = chart.Spec.ValuesContent
|
||||||
|
}
|
||||||
|
|
||||||
|
return configMap
|
||||||
|
}
|
||||||
|
|
||||||
|
func valuesConfigMapAddConfig(configMap *core.ConfigMap, config *helmv1.HelmChartConfig) {
|
||||||
|
if config.Spec.ValuesContent != "" {
|
||||||
|
configMap.Data["values-10_HelmChartConfig.yaml"] = config.Spec.ValuesContent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,10 +423,7 @@ func setProxyEnv(job *batch.Job) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func contentConfigMap(chart *helmv1.HelmChart) *core.ConfigMap {
|
func contentConfigMap(chart *helmv1.HelmChart) *core.ConfigMap {
|
||||||
if chart.Spec.ChartContent == "" {
|
configMap := &core.ConfigMap{
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &core.ConfigMap{
|
|
||||||
TypeMeta: meta.TypeMeta{
|
TypeMeta: meta.TypeMeta{
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Kind: "ConfigMap",
|
Kind: "ConfigMap",
|
||||||
|
@ -402,17 +432,19 @@ func contentConfigMap(chart *helmv1.HelmChart) *core.ConfigMap {
|
||||||
Name: fmt.Sprintf("chart-content-%s", chart.Name),
|
Name: fmt.Sprintf("chart-content-%s", chart.Name),
|
||||||
Namespace: chart.Namespace,
|
Namespace: chart.Namespace,
|
||||||
},
|
},
|
||||||
Data: map[string]string{
|
Data: map[string]string{},
|
||||||
fmt.Sprintf("%s.tgz.base64", chart.Name): chart.Spec.ChartContent,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if chart.Spec.ChartContent != "" {
|
||||||
|
key := fmt.Sprintf("%s.tgz.base64", chart.Name)
|
||||||
|
configMap.Data[key] = chart.Spec.ValuesContent
|
||||||
|
}
|
||||||
|
|
||||||
|
return configMap
|
||||||
}
|
}
|
||||||
|
|
||||||
func setValuesConfigMap(job *batch.Job, chart *helmv1.HelmChart) *core.ConfigMap {
|
func setValuesConfigMap(job *batch.Job, chart *helmv1.HelmChart) *core.ConfigMap {
|
||||||
configMap := valuesConfigMap(chart)
|
configMap := valuesConfigMap(chart)
|
||||||
if configMap == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
job.Spec.Template.Spec.Volumes = append(job.Spec.Template.Spec.Volumes, []core.Volume{
|
job.Spec.Template.Spec.Volumes = append(job.Spec.Template.Spec.Volumes, []core.Volume{
|
||||||
{
|
{
|
||||||
|
@ -465,3 +497,20 @@ func setContentConfigMap(job *batch.Job, chart *helmv1.HelmChart) *core.ConfigMa
|
||||||
|
|
||||||
return configMap
|
return configMap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func hashConfigMaps(job *batch.Job, maps ...*core.ConfigMap) {
|
||||||
|
hash := sha256.New()
|
||||||
|
|
||||||
|
for _, configMap := range maps {
|
||||||
|
for k, v := range configMap.Data {
|
||||||
|
hash.Write([]byte(k))
|
||||||
|
hash.Write([]byte(v))
|
||||||
|
}
|
||||||
|
for k, v := range configMap.BinaryData {
|
||||||
|
hash.Write([]byte(k))
|
||||||
|
hash.Write(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
job.Spec.Template.ObjectMeta.Annotations[Annotation] = fmt.Sprintf("SHA256=%X", hash.Sum(nil))
|
||||||
|
}
|
||||||
|
|
|
@ -736,7 +736,7 @@ github.com/rancher/dynamiclistener/storage/memory
|
||||||
# github.com/rancher/go-powershell v0.0.0-20200701182037-6845e6fcfa79
|
# github.com/rancher/go-powershell v0.0.0-20200701182037-6845e6fcfa79
|
||||||
github.com/rancher/go-powershell/backend
|
github.com/rancher/go-powershell/backend
|
||||||
github.com/rancher/go-powershell/utils
|
github.com/rancher/go-powershell/utils
|
||||||
# github.com/rancher/helm-controller v0.6.5
|
# github.com/rancher/helm-controller v0.7.0
|
||||||
github.com/rancher/helm-controller/pkg/apis/helm.cattle.io
|
github.com/rancher/helm-controller/pkg/apis/helm.cattle.io
|
||||||
github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1
|
github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1
|
||||||
github.com/rancher/helm-controller/pkg/generated/clientset/versioned
|
github.com/rancher/helm-controller/pkg/generated/clientset/versioned
|
||||||
|
|
Loading…
Reference in New Issue