diff --git a/cmpserver/apiclient/plugin.pb.go b/cmpserver/apiclient/plugin.pb.go index 4c195fb0510a5..4c08ac2511edc 100644 --- a/cmpserver/apiclient/plugin.pb.go +++ b/cmpserver/apiclient/plugin.pb.go @@ -6,6 +6,7 @@ package apiclient import ( context "context" fmt "fmt" + apiclient "github.com/argoproj/argo-cd/v2/reposerver/apiclient" proto "github.com/gogo/protobuf/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -362,143 +363,20 @@ func (m *RepositoryResponse) GetIsSupported() bool { return false } -type ParameterAnnouncement struct { - // name is the name identifying a parameter. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // title is a human-readable text of the parameter name. - Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` - // tooltip is a human-readable description of the parameter. - Tooltip string `protobuf:"bytes,3,opt,name=tooltip,proto3" json:"tooltip,omitempty"` - // required defines if this given parameter is mandatory. - Required bool `protobuf:"varint,4,opt,name=required,proto3" json:"required,omitempty"` - // itemType determines the primitive data type represented by the parameter. Parameters are always encoded as - // strings, but this field lets them be interpreted as other primitive types. - ItemType string `protobuf:"bytes,5,opt,name=itemType,proto3" json:"itemType,omitempty"` - // collectionType is the type of value this parameter holds - either a single value (a string) or a collection - // (array or map). If collectionType is set, only the field with that type will be used. If collectionType is not - // set, `string` is the default. If collectionType is set to an invalid value, a validation error is thrown. - CollectionType string `protobuf:"bytes,6,opt,name=collectionType,proto3" json:"collectionType,omitempty"` - // string is the default value of the parameter if the parameter is a string. - String_ string `protobuf:"bytes,7,opt,name=string,proto3" json:"string,omitempty"` - // array is the default value of the parameter if the parameter is an array. - Array []string `protobuf:"bytes,8,rep,name=array,proto3" json:"array,omitempty"` - // map is the default value of the parameter if the parameter is a map. - Map map[string]string `protobuf:"bytes,9,rep,name=map,proto3" json:"map,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ParameterAnnouncement) Reset() { *m = ParameterAnnouncement{} } -func (m *ParameterAnnouncement) String() string { return proto.CompactTextString(m) } -func (*ParameterAnnouncement) ProtoMessage() {} -func (*ParameterAnnouncement) Descriptor() ([]byte, []int) { - return fileDescriptor_b21875a7079a06ed, []int{5} -} -func (m *ParameterAnnouncement) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ParameterAnnouncement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ParameterAnnouncement.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ParameterAnnouncement) XXX_Merge(src proto.Message) { - xxx_messageInfo_ParameterAnnouncement.Merge(m, src) -} -func (m *ParameterAnnouncement) XXX_Size() int { - return m.Size() -} -func (m *ParameterAnnouncement) XXX_DiscardUnknown() { - xxx_messageInfo_ParameterAnnouncement.DiscardUnknown(m) -} - -var xxx_messageInfo_ParameterAnnouncement proto.InternalMessageInfo - -func (m *ParameterAnnouncement) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *ParameterAnnouncement) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *ParameterAnnouncement) GetTooltip() string { - if m != nil { - return m.Tooltip - } - return "" -} - -func (m *ParameterAnnouncement) GetRequired() bool { - if m != nil { - return m.Required - } - return false -} - -func (m *ParameterAnnouncement) GetItemType() string { - if m != nil { - return m.ItemType - } - return "" -} - -func (m *ParameterAnnouncement) GetCollectionType() string { - if m != nil { - return m.CollectionType - } - return "" -} - -func (m *ParameterAnnouncement) GetString_() string { - if m != nil { - return m.String_ - } - return "" -} - -func (m *ParameterAnnouncement) GetArray() []string { - if m != nil { - return m.Array - } - return nil -} - -func (m *ParameterAnnouncement) GetMap() map[string]string { - if m != nil { - return m.Map - } - return nil -} - // ParametersAnnouncementResponse contains a list of announcements. This list represents all the parameters which a CMP // is able to accept. type ParametersAnnouncementResponse struct { - ParameterAnnouncements []*ParameterAnnouncement `protobuf:"bytes,1,rep,name=parameterAnnouncements,proto3" json:"parameterAnnouncements,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ParameterAnnouncements []*apiclient.ParameterAnnouncement `protobuf:"bytes,1,rep,name=parameterAnnouncements,proto3" json:"parameterAnnouncements,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ParametersAnnouncementResponse) Reset() { *m = ParametersAnnouncementResponse{} } func (m *ParametersAnnouncementResponse) String() string { return proto.CompactTextString(m) } func (*ParametersAnnouncementResponse) ProtoMessage() {} func (*ParametersAnnouncementResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b21875a7079a06ed, []int{6} + return fileDescriptor_b21875a7079a06ed, []int{5} } func (m *ParametersAnnouncementResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -527,7 +405,7 @@ func (m *ParametersAnnouncementResponse) XXX_DiscardUnknown() { var xxx_messageInfo_ParametersAnnouncementResponse proto.InternalMessageInfo -func (m *ParametersAnnouncementResponse) GetParameterAnnouncements() []*ParameterAnnouncement { +func (m *ParametersAnnouncementResponse) GetParameterAnnouncements() []*apiclient.ParameterAnnouncement { if m != nil { return m.ParameterAnnouncements } @@ -545,7 +423,7 @@ func (m *File) Reset() { *m = File{} } func (m *File) String() string { return proto.CompactTextString(m) } func (*File) ProtoMessage() {} func (*File) Descriptor() ([]byte, []int) { - return fileDescriptor_b21875a7079a06ed, []int{7} + return fileDescriptor_b21875a7079a06ed, []int{6} } func (m *File) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -587,8 +465,6 @@ func init() { proto.RegisterType((*EnvEntry)(nil), "plugin.EnvEntry") proto.RegisterType((*ManifestResponse)(nil), "plugin.ManifestResponse") proto.RegisterType((*RepositoryResponse)(nil), "plugin.RepositoryResponse") - proto.RegisterType((*ParameterAnnouncement)(nil), "plugin.ParameterAnnouncement") - proto.RegisterMapType((map[string]string)(nil), "plugin.ParameterAnnouncement.MapEntry") proto.RegisterType((*ParametersAnnouncementResponse)(nil), "plugin.ParametersAnnouncementResponse") proto.RegisterType((*File)(nil), "plugin.File") } @@ -596,49 +472,42 @@ func init() { func init() { proto.RegisterFile("cmpserver/plugin/plugin.proto", fileDescriptor_b21875a7079a06ed) } var fileDescriptor_b21875a7079a06ed = []byte{ - // 672 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xcf, 0x6e, 0x13, 0x3f, - 0x10, 0xee, 0x26, 0x69, 0xba, 0x99, 0x54, 0xbf, 0x5f, 0x64, 0x41, 0x59, 0xa2, 0x36, 0x44, 0x7b, - 0xa8, 0x72, 0x21, 0x91, 0x02, 0xaa, 0x2a, 0x24, 0x24, 0x5a, 0x54, 0x5a, 0x81, 0x82, 0x22, 0x17, - 0x2e, 0xdc, 0xdc, 0xcd, 0x34, 0x31, 0xdd, 0xb5, 0x8d, 0xd7, 0x1b, 0x14, 0x4e, 0xbc, 0x07, 0x0f, - 0xc0, 0xab, 0x70, 0xe4, 0xce, 0x05, 0xf5, 0x49, 0xd0, 0x7a, 0xff, 0x24, 0x6a, 0xd3, 0x9e, 0xd6, - 0xdf, 0x8c, 0xe7, 0xf3, 0x37, 0xf3, 0x79, 0x0d, 0x7b, 0x41, 0xa4, 0x62, 0xd4, 0x73, 0xd4, 0x03, - 0x15, 0x26, 0x53, 0x2e, 0xf2, 0x4f, 0x5f, 0x69, 0x69, 0x24, 0xa9, 0x67, 0xc8, 0xff, 0xee, 0x40, - 0xeb, 0x48, 0xa9, 0x73, 0xa3, 0x91, 0x45, 0x14, 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00, 0x14, 0x71, 0x05, 0x00, 0x00, + // 558 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0xc1, 0x6e, 0xd3, 0x4c, + 0x10, 0xae, 0x9b, 0xb4, 0x4d, 0x26, 0x95, 0xfe, 0x68, 0xf5, 0x0b, 0x4c, 0xd4, 0x86, 0xe0, 0x03, + 0xca, 0x85, 0x44, 0x32, 0x88, 0x1b, 0x12, 0x2d, 0x2a, 0xad, 0x40, 0x41, 0xd1, 0x96, 0x0b, 0xdc, + 0xb6, 0xce, 0x24, 0x59, 0x6a, 0xef, 0x2e, 0xeb, 0xb5, 0xa5, 0xc0, 0x85, 0xf7, 0xe0, 0x01, 0x78, + 0x15, 0x8e, 0x3c, 0x02, 0xca, 0x93, 0x20, 0xaf, 0xed, 0xd8, 0xa2, 0x6d, 0x38, 0x79, 0xe6, 0x9b, + 0x99, 0x6f, 0xbf, 0x9d, 0x99, 0x35, 0x1c, 0x07, 0x91, 0x8a, 0x51, 0xa7, 0xa8, 0xc7, 0x2a, 0x4c, + 0x16, 0x5c, 0x14, 0x9f, 0x91, 0xd2, 0xd2, 0x48, 0xb2, 0x9f, 0x7b, 0xbd, 0xb3, 0x05, 0x37, 0xcb, + 0xe4, 0x6a, 0x14, 0xc8, 0x68, 0xcc, 0xf4, 0x42, 0x2a, 0x2d, 0x3f, 0x59, 0xe3, 0x49, 0x30, 0x1b, + 0xa7, 0xfe, 0x58, 0xa3, 0x92, 0x05, 0x8d, 0x35, 0xb9, 0x91, 0x7a, 0x55, 0x33, 0x73, 0x3a, 0xef, + 0x9b, 0x03, 0xdd, 0x13, 0xa5, 0x2e, 0x8d, 0x46, 0x16, 0x51, 0xfc, 0x9c, 0x60, 0x6c, 0xc8, 0x0b, + 0x68, 0x45, 0x68, 0xd8, 0x8c, 0x19, 0xe6, 0x3a, 0x03, 0x67, 0xd8, 0xf1, 0x1f, 0x8e, 0x0a, 0x11, + 0x13, 0x26, 0xf8, 0x1c, 0x63, 0x53, 0xa4, 0x4e, 0x8a, 0xb4, 0x8b, 0x1d, 0xba, 0x29, 0x21, 0x1e, + 0x34, 0xe7, 0x3c, 0x44, 0x77, 0xd7, 0x96, 0x1e, 0x96, 0xa5, 0xaf, 0x79, 0x88, 0x17, 0x3b, 0xd4, + 0xc6, 0x4e, 0xdb, 0x70, 0xa0, 0x73, 0x0a, 0xef, 0x87, 0x03, 0xf7, 0xef, 0xa0, 0x25, 0x2e, 0x1c, + 0x30, 0xa5, 0xde, 0xb1, 0x08, 0xad, 0x90, 0x36, 0x2d, 0x5d, 0xd2, 0x07, 0x60, 0x4a, 0x51, 0x0c, + 0xa7, 0xcc, 0x2c, 0xed, 0x51, 0x6d, 0x5a, 0x43, 0x48, 0x0f, 0x5a, 0xc1, 0x12, 0x83, 0xeb, 0x38, + 0x89, 0xdc, 0x86, 0x8d, 0x6e, 0x7c, 0x42, 0xa0, 0x19, 0xf3, 0x2f, 0xe8, 0x36, 0x07, 0xce, 0xb0, + 0x41, 0xad, 0x4d, 0x3c, 0x68, 0xa0, 0x48, 0xdd, 0xbd, 0x41, 0x63, 0xd8, 0xf1, 0xbb, 0xa5, 0xe6, + 0x33, 0x91, 0x9e, 0x09, 0xa3, 0x57, 0x34, 0x0b, 0x7a, 0xcf, 0xa0, 0x55, 0x02, 0x19, 0x87, 0xa8, + 0x64, 0x59, 0x9b, 0xfc, 0x0f, 0x7b, 0x29, 0x0b, 0x13, 0x2c, 0xe4, 0xe4, 0x8e, 0x37, 0x85, 0x6e, + 0x75, 0xbd, 0x58, 0x49, 0x11, 0x23, 0x39, 0x82, 0x76, 0x54, 0x60, 0xb1, 0xeb, 0x0c, 0x1a, 0xc3, + 0x36, 0xad, 0x80, 0xec, 0x6e, 0xb1, 0x4c, 0x74, 0x80, 0xef, 0x57, 0xaa, 0x24, 0xab, 0x21, 0xde, + 0x73, 0x20, 0x74, 0x33, 0xc8, 0x0d, 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0xd5, 0xbe, 0x7d, 0xee, 0x4f, + 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x33, 0x34, 0xb3, 0x95, 0x5e, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1169,113 +1038,6 @@ func (m *RepositoryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ParameterAnnouncement) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ParameterAnnouncement) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ParameterAnnouncement) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Map) > 0 { - for k := range m.Map { - v := m.Map[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintPlugin(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintPlugin(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintPlugin(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x4a - } - } - if len(m.Array) > 0 { - for iNdEx := len(m.Array) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Array[iNdEx]) - copy(dAtA[i:], m.Array[iNdEx]) - i = encodeVarintPlugin(dAtA, i, uint64(len(m.Array[iNdEx]))) - i-- - dAtA[i] = 0x42 - } - } - if len(m.String_) > 0 { - i -= len(m.String_) - copy(dAtA[i:], m.String_) - i = encodeVarintPlugin(dAtA, i, uint64(len(m.String_))) - i-- - dAtA[i] = 0x3a - } - if len(m.CollectionType) > 0 { - i -= len(m.CollectionType) - copy(dAtA[i:], m.CollectionType) - i = encodeVarintPlugin(dAtA, i, uint64(len(m.CollectionType))) - i-- - dAtA[i] = 0x32 - } - if len(m.ItemType) > 0 { - i -= len(m.ItemType) - copy(dAtA[i:], m.ItemType) - i = encodeVarintPlugin(dAtA, i, uint64(len(m.ItemType))) - i-- - dAtA[i] = 0x2a - } - if m.Required { - i-- - if m.Required { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if len(m.Tooltip) > 0 { - i -= len(m.Tooltip) - copy(dAtA[i:], m.Tooltip) - i = encodeVarintPlugin(dAtA, i, uint64(len(m.Tooltip))) - i-- - dAtA[i] = 0x1a - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintPlugin(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintPlugin(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *ParametersAnnouncementResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1491,59 +1253,6 @@ func (m *RepositoryResponse) Size() (n int) { return n } -func (m *ParameterAnnouncement) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovPlugin(uint64(l)) - } - l = len(m.Title) - if l > 0 { - n += 1 + l + sovPlugin(uint64(l)) - } - l = len(m.Tooltip) - if l > 0 { - n += 1 + l + sovPlugin(uint64(l)) - } - if m.Required { - n += 2 - } - l = len(m.ItemType) - if l > 0 { - n += 1 + l + sovPlugin(uint64(l)) - } - l = len(m.CollectionType) - if l > 0 { - n += 1 + l + sovPlugin(uint64(l)) - } - l = len(m.String_) - if l > 0 { - n += 1 + l + sovPlugin(uint64(l)) - } - if len(m.Array) > 0 { - for _, s := range m.Array { - l = len(s) - n += 1 + l + sovPlugin(uint64(l)) - } - } - if len(m.Map) > 0 { - for k, v := range m.Map { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovPlugin(uint64(len(k))) + 1 + len(v) + sovPlugin(uint64(len(v))) - n += mapEntrySize + 1 + sovPlugin(uint64(mapEntrySize)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - func (m *ParametersAnnouncementResponse) Size() (n int) { if m == nil { return 0 @@ -2206,428 +1915,6 @@ func (m *RepositoryResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *ParameterAnnouncement) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlugin - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ParameterAnnouncement: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ParameterAnnouncement: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlugin - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPlugin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPlugin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlugin - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPlugin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPlugin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tooltip", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlugin - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPlugin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPlugin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Tooltip = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Required", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlugin - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Required = bool(v != 0) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ItemType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlugin - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPlugin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPlugin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ItemType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollectionType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlugin - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPlugin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPlugin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CollectionType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field String_", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlugin - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPlugin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPlugin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.String_ = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Array", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlugin - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPlugin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPlugin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Array = append(m.Array, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Map", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlugin - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlugin - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPlugin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Map == nil { - m.Map = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlugin - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlugin - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthPlugin - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthPlugin - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlugin - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthPlugin - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthPlugin - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipPlugin(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPlugin - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Map[mapkey] = mapvalue - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPlugin(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPlugin - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *ParametersAnnouncementResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2686,7 +1973,7 @@ func (m *ParametersAnnouncementResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ParameterAnnouncements = append(m.ParameterAnnouncements, &ParameterAnnouncement{}) + m.ParameterAnnouncements = append(m.ParameterAnnouncements, &apiclient.ParameterAnnouncement{}) if err := m.ParameterAnnouncements[len(m.ParameterAnnouncements)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/cmpserver/plugin/config.go b/cmpserver/plugin/config.go index b356d8ffcaf85..f96d6768a241b 100644 --- a/cmpserver/plugin/config.go +++ b/cmpserver/plugin/config.go @@ -7,6 +7,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/argoproj/argo-cd/v2/common" + "github.com/argoproj/argo-cd/v2/reposerver/apiclient" configUtil "github.com/argoproj/argo-cd/v2/util/config" ) @@ -50,21 +51,8 @@ type Find struct { // Parameters holds static and dynamic configurations type Parameters struct { - Static []Static `yaml:"static"` - Dynamic Command `yaml:"dynamic"` -} - -// Static hold the static announcements for CMP's -type Static struct { - Name string `yaml:"name,omitempty"` - Title string `yaml:"title,omitempty"` - Tooltip string `yaml:"tooltip,omitempty"` - Required bool `yaml:"required,omitempty"` - ItemType string `yaml:"itemType,omitempty"` - CollectionType string `yaml:"collectionType,omitempty"` - String string `yaml:"string,omitempty"` - Array []string `yaml:"array,omitempty"` - Map map[string]string `yaml:"map,omitempty"` + Static []*apiclient.ParameterAnnouncement `yaml:"static"` + Dynamic Command `yaml:"dynamic"` } // Dynamic hold the dynamic announcements for CMP's diff --git a/cmpserver/plugin/plugin.go b/cmpserver/plugin/plugin.go index 5bc621783ddc9..3990b0fa2796d 100644 --- a/cmpserver/plugin/plugin.go +++ b/cmpserver/plugin/plugin.go @@ -16,6 +16,7 @@ import ( "github.com/argoproj/argo-cd/v2/cmpserver/apiclient" "github.com/argoproj/argo-cd/v2/common" + repoclient "github.com/argoproj/argo-cd/v2/reposerver/apiclient" "github.com/argoproj/argo-cd/v2/util/buffered_context" "github.com/argoproj/argo-cd/v2/util/cmp" "github.com/argoproj/argo-cd/v2/util/io/files" @@ -143,20 +144,31 @@ func environ(envVars []*apiclient.EnvEntry) []string { return environ } +// getTempDirMustCleanup creates a temporary directory and returns a cleanup function. The cleanup function panics if +// cleanup fails. Use this function when failing to clean up the temporary directory is a security risk. +func getTempDirMustCleanup(baseDir string) (workDir string, cleanup func(), err error) { + workDir, err = files.CreateTempDir(baseDir) + if err != nil { + return "", nil, fmt.Errorf("error creating temp dir: %s", err) + } + cleanup = func() { + if err := os.RemoveAll(workDir); err != nil { + // we panic here as the workDir may contain sensitive information + panic(fmt.Sprintf("error removing plugin workdir: %s", err)) + } + } + return workDir, cleanup, nil +} + // GenerateManifest runs generate command from plugin config file and returns generated manifest files func (s *Service) GenerateManifest(stream apiclient.ConfigManagementPluginService_GenerateManifestServer) error { ctx, cancel := buffered_context.WithEarlierDeadline(stream.Context(), cmpTimeoutBuffer) defer cancel() - workDir, err := files.CreateTempDir(common.GetCMPWorkDir()) + workDir, cleanup, err := getTempDirMustCleanup(common.GetCMPWorkDir()) if err != nil { - return fmt.Errorf("error creating temp dir: %s", err) + return fmt.Errorf("error creating workdir for manifest generation: %s", err) } - defer func() { - if err := os.RemoveAll(workDir); err != nil { - // we panic here as the workDir may contain sensitive information - panic(fmt.Sprintf("error removing generate manifest workdir: %s", err)) - } - }() + defer cleanup() metadata, err := cmp.ReceiveRepoStream(ctx, stream, workDir) if err != nil { @@ -222,16 +234,11 @@ func (s *Service) MatchRepository(stream apiclient.ConfigManagementPluginService bufferedCtx, cancel := buffered_context.WithEarlierDeadline(stream.Context(), cmpTimeoutBuffer) defer cancel() - workDir, err := files.CreateTempDir(common.GetCMPWorkDir()) + workDir, cleanup, err := getTempDirMustCleanup(common.GetCMPWorkDir()) if err != nil { - return fmt.Errorf("error creating match repository workdir: %s", err) + return fmt.Errorf("error creating workdir for repository matching: %s", err) } - defer func() { - if err := os.RemoveAll(workDir); err != nil { - // we panic here as the workDir may contain sensitive information - panic(fmt.Sprintf("error removing match repository workdir: %s", err)) - } - }() + defer cleanup() _, err = cmp.ReceiveRepoStream(bufferedCtx, stream, workDir) if err != nil { @@ -299,16 +306,11 @@ func (s *Service) GetParametersAnnouncement(stream apiclient.ConfigManagementPlu bufferedCtx, cancel := buffered_context.WithEarlierDeadline(stream.Context(), cmpTimeoutBuffer) defer cancel() - workDir, err := files.CreateTempDir(common.GetCMPWorkDir()) + workDir, cleanup, err := getTempDirMustCleanup(common.GetCMPWorkDir()) if err != nil { - return fmt.Errorf("error creating parameters announcement workdir: %s", err) + return fmt.Errorf("error creating workdir for generating parameter announcements: %s", err) } - defer func() { - if err := os.RemoveAll(workDir); err != nil { - // we panic here as the workDir may contain sensitive information - panic(fmt.Sprintf("error removing parameters announcement repository workdir: %s", err)) - } - }() + defer cleanup() metadata, err := cmp.ReceiveRepoStream(bufferedCtx, stream, workDir) if err != nil { @@ -331,29 +333,14 @@ func (s *Service) GetParametersAnnouncement(stream apiclient.ConfigManagementPlu return nil } -func getParametersAnnouncement(ctx context.Context, appDir string, staticAnnouncements []Static, command Command) (*apiclient.ParametersAnnouncementResponse, error) { - var announcements []*apiclient.ParameterAnnouncement - for _, static := range staticAnnouncements { - announcements = append(announcements, &apiclient.ParameterAnnouncement{ - Name: static.Name, - Title: static.Title, - Tooltip: static.Tooltip, - Required: static.Required, - ItemType: static.ItemType, - CollectionType: static.CollectionType, - String_: static.String, - Array: static.Array, - Map: static.Map, - }) - } - +func getParametersAnnouncement(ctx context.Context, appDir string, announcements []*repoclient.ParameterAnnouncement, command Command) (*apiclient.ParametersAnnouncementResponse, error) { if len(command.Command) > 0 { stdout, err := runCommand(ctx, command, appDir, os.Environ()) if err != nil { return nil, fmt.Errorf("error executing dynamic parameter output command: %s", err) } - var dynamicParamAnnouncements []*apiclient.ParameterAnnouncement + var dynamicParamAnnouncements []*repoclient.ParameterAnnouncement err = json.Unmarshal([]byte(stdout), &dynamicParamAnnouncements) if err != nil { return nil, fmt.Errorf("error unmarshaling dynamic parameter output into ParametersAnnouncementResponse: %s", err) diff --git a/cmpserver/plugin/plugin.proto b/cmpserver/plugin/plugin.proto index fb2c62f3c164b..b6dc23232e8a1 100644 --- a/cmpserver/plugin/plugin.proto +++ b/cmpserver/plugin/plugin.proto @@ -3,6 +3,8 @@ option go_package = "github.com/argoproj/argo-cd/v2/cmpserver/apiclient"; package plugin; +import "github.com/argoproj/argo-cd/v2/reposerver/repository/repository.proto"; + // AppStreamRequest is the request object used to send the application's // files over a stream. message AppStreamRequest { @@ -44,34 +46,10 @@ message RepositoryResponse { bool isSupported = 1; } -message ParameterAnnouncement { - // name is the name identifying a parameter. - string name = 1; - // title is a human-readable text of the parameter name. - string title = 2; - // tooltip is a human-readable description of the parameter. - string tooltip = 3; - // required defines if this given parameter is mandatory. - bool required = 4; - // itemType determines the primitive data type represented by the parameter. Parameters are always encoded as - // strings, but this field lets them be interpreted as other primitive types. - string itemType = 5; - // collectionType is the type of value this parameter holds - either a single value (a string) or a collection - // (array or map). If collectionType is set, only the field with that type will be used. If collectionType is not - // set, `string` is the default. If collectionType is set to an invalid value, a validation error is thrown. - string collectionType = 6; - // string is the default value of the parameter if the parameter is a string. - string string = 7; - // array is the default value of the parameter if the parameter is an array. - repeated string array = 8; - // map is the default value of the parameter if the parameter is a map. - map map = 9; -} - // ParametersAnnouncementResponse contains a list of announcements. This list represents all the parameters which a CMP // is able to accept. message ParametersAnnouncementResponse { - repeated ParameterAnnouncement parameterAnnouncements = 1; + repeated repository.ParameterAnnouncement parameterAnnouncements = 1; } message File { diff --git a/cmpserver/plugin/plugin_test.go b/cmpserver/plugin/plugin_test.go index 23f23bef07ad2..b3940aa0256ec 100644 --- a/cmpserver/plugin/plugin_test.go +++ b/cmpserver/plugin/plugin_test.go @@ -2,6 +2,7 @@ package plugin import ( "context" + "os" "path/filepath" "testing" "time" @@ -11,7 +12,7 @@ import ( "gopkg.in/yaml.v2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/argoproj/argo-cd/v2/cmpserver/apiclient" + repoclient "github.com/argoproj/argo-cd/v2/reposerver/apiclient" "github.com/argoproj/argo-cd/v2/test" ) @@ -234,7 +235,7 @@ func Test_getParametersAnnouncement_empty_command(t *testing.T) { - name: static-a - name: static-b ` - static := &[]Static{} + static := &[]*repoclient.ParameterAnnouncement{} err := yaml.Unmarshal([]byte(staticYAML), static) require.NoError(t, err) command := Command{ @@ -243,7 +244,7 @@ func Test_getParametersAnnouncement_empty_command(t *testing.T) { } res, err := getParametersAnnouncement(context.Background(), "", *static, command) require.NoError(t, err) - assert.Equal(t, []*apiclient.ParameterAnnouncement{{Name: "static-a"}, {Name: "static-b"}}, res.ParameterAnnouncements) + assert.Equal(t, []*repoclient.ParameterAnnouncement{{Name: "static-a"}, {Name: "static-b"}}, res.ParameterAnnouncements) } func Test_getParametersAnnouncement_no_command(t *testing.T) { @@ -251,13 +252,13 @@ func Test_getParametersAnnouncement_no_command(t *testing.T) { - name: static-a - name: static-b ` - static := &[]Static{} + static := &[]*repoclient.ParameterAnnouncement{} err := yaml.Unmarshal([]byte(staticYAML), static) require.NoError(t, err) command := Command{} res, err := getParametersAnnouncement(context.Background(), "", *static, command) require.NoError(t, err) - assert.Equal(t, []*apiclient.ParameterAnnouncement{{Name: "static-a"}, {Name: "static-b"}}, res.ParameterAnnouncements) + assert.Equal(t, []*repoclient.ParameterAnnouncement{{Name: "static-a"}, {Name: "static-b"}}, res.ParameterAnnouncements) } func Test_getParametersAnnouncement_static_and_dynamic(t *testing.T) { @@ -265,7 +266,7 @@ func Test_getParametersAnnouncement_static_and_dynamic(t *testing.T) { - name: static-a - name: static-b ` - static := &[]Static{} + static := &[]*repoclient.ParameterAnnouncement{} err := yaml.Unmarshal([]byte(staticYAML), static) require.NoError(t, err) command := Command{ @@ -274,7 +275,7 @@ func Test_getParametersAnnouncement_static_and_dynamic(t *testing.T) { } res, err := getParametersAnnouncement(context.Background(), "", *static, command) require.NoError(t, err) - expected := []*apiclient.ParameterAnnouncement{ + expected := []*repoclient.ParameterAnnouncement{ {Name: "dynamic-a"}, {Name: "dynamic-b"}, {Name: "static-a"}, @@ -288,7 +289,7 @@ func Test_getParametersAnnouncement_invalid_json(t *testing.T) { Command: []string{"echo"}, Args: []string{`[`}, } - _, err := getParametersAnnouncement(context.Background(), "", []Static{}, command) + _, err := getParametersAnnouncement(context.Background(), "", []*repoclient.ParameterAnnouncement{}, command) assert.Error(t, err) assert.Contains(t, err.Error(), "unexpected end of JSON input") } @@ -298,7 +299,26 @@ func Test_getParametersAnnouncement_bad_command(t *testing.T) { Command: []string{"exit"}, Args: []string{"1"}, } - _, err := getParametersAnnouncement(context.Background(), "", []Static{}, command) + _, err := getParametersAnnouncement(context.Background(), "", []*repoclient.ParameterAnnouncement{}, command) assert.Error(t, err) assert.Contains(t, err.Error(), "error executing dynamic parameter output command") } + +func Test_getTempDirMustCleanup(t *testing.T) { + tempDir := t.TempDir() + workDir, cleanup, err := getTempDirMustCleanup(tempDir) + require.NoError(t, err) + require.DirExists(t, workDir) + + // Induce a cleanup error to verify panic behavior. + err = os.Chmod(tempDir, 0000) + require.NoError(t, err) + assert.Panics(t, func() { + cleanup() + }, "cleanup must panic to protect from directory traversal vulnerabilities") + + err = os.Chmod(tempDir, 0700) + require.NoError(t, err) + cleanup() + assert.NoDirExists(t, workDir) +} diff --git a/docs/operator-manual/application.yaml b/docs/operator-manual/application.yaml index a61d02b8d35bf..edbb3a9744417 100644 --- a/docs/operator-manual/application.yaml +++ b/docs/operator-manual/application.yaml @@ -95,6 +95,7 @@ spec: # plugin specific config plugin: + # NOTE: this field is deprecated in v2.4 and must be removed to use sidecar-based plugins. # Only set the plugin name if the plugin is defined in argocd-cm. # If the plugin is defined as a sidecar, omit the name. The plugin will be automatically matched with the # Application according to the plugin's discovery rules. @@ -103,6 +104,15 @@ spec: env: - name: FOO value: bar + # Plugin parameters are new in v2.4. + parameters: + - name: string-param + string: example-string + - name: array-param + array: [item1, item2] + - name: map-param + map: + param-name: param-value # Destination cluster and namespace to deploy the application destination: diff --git a/docs/user-guide/config-management-plugins.md b/docs/user-guide/config-management-plugins.md index 7bd92cbd335c1..01de3137aab5b 100644 --- a/docs/user-guide/config-management-plugins.md +++ b/docs/user-guide/config-management-plugins.md @@ -1,54 +1,15 @@ # Plugins -Argo CD allows integrating more config management tools using config management plugins. +Argo CD allows integrating more config management tools using config management plugins. The following sections will +describe how to create, install, and use plugins. Check out the +[example plugins](https://github.com/argoproj/argo-cd/tree/master/examples/plugins) for additional guidance. -## Installing a CMP +## Installing a config management plugin -There are two ways to install a Config Management Plugin (CMP): -1. Add the plugin config to the Argo CD ConfigMap. The repo-server container will run your plugin's commands. +An operator can configure a plugin by adding a sidecar to argocd-repo-server Deployment. The following changes are +required to configure a new plugin: - This is a good option for a simple plugin that requires only a few lines of code that fit nicely in the Argo CD ConfigMap. -2. Add the plugin as a sidecar to the repo-server Pod. - - This is a good option for a more complex plugin that would clutter the Argo CD ConfigMap. - -### Option 1: Configure plugins via Argo CD configmap - -The following changes are required to configure a new plugin: - -1. Make sure required binaries are available in `argocd-repo-server` pod. The binaries can be added via volume mounts or - using a custom image (see [custom_tools](../operator-manual/custom_tools.md) for examples of both). -2. Register a new plugin in `argocd-cm` ConfigMap: - - :::yaml - data: - configManagementPlugins: | - - name: pluginName - init: # Optional command to initialize application source directory - command: ["sample command"] - args: ["sample args"] - generate: # Command to generate manifests YAML - command: ["sample command"] - args: ["sample args"] - lockRepo: true # Defaults to false. See below. - - The `generate` command must print a valid YAML or JSON stream to stdout. Both `init` and `generate` commands are executed inside the application source directory or in `path` when specified for the app. - -3. [Create an Application which uses your new CMP](#using-a-cmp). - -More CMP examples are available in [argocd-example-apps](https://github.com/argoproj/argocd-example-apps/tree/master/plugins). - -!!!note "Repository locking" - If your plugin makes use of `git` (e.g. `git crypt`), it is advised to set - `lockRepo` to `true` so that your plugin will have exclusive access to the - repository at the time it is executed. Otherwise, two applications synced - at the same time may result in a race condition and sync failure. - -### Option 2: Configure plugin via sidecar - -An operator can configure a plugin tool via a sidecar to repo-server. The following changes are required to configure a new plugin: - -#### 1. Write the plugin configuration file +### 1. Write the plugin configuration file Plugins will be configured via a ConfigManagementPlugin manifest located inside the plugin container. @@ -56,77 +17,116 @@ Plugins will be configured via a ConfigManagementPlugin manifest located inside apiVersion: argoproj.io/v1alpha1 kind: ConfigManagementPlugin metadata: - name: cmp-plugin + # The name of the plugin must be unique within a given Argo CD instance. + name: my-plugin spec: - version: v1.0 + # The init command runs in the Application source directory at the beginning of each manifest generation. The init + # command can output anything. A non-zero status code will fail manifest generation. + init: + command: [] + args: [] + # The generate command runs in the Application source directory each time manifests are generated. Standard output + # must be ONLY valid JSON or YAML manifests. A non-zero exit code will fail manifest generation. + # Error output will be sent to the UI, so avoid printing sensitive information (such as secrets). generate: - command: [sh, -c, 'echo "{\"kind\": \"ConfigMap\", \"apiVersion\": \"v1\", \"metadata\": { \"name\": \"$ARGOCD_APP_NAME\", \"namespace\": \"$ARGOCD_APP_NAMESPACE\", \"annotations\": {\"Foo\": \"$FOO\", \"KubeVersion\": \"$KUBE_VERSION\", \"KubeApiVersion\": \"$KUBE_API_VERSIONS\",\"Bar\": \"baz\"}}}"'] + command: [sh, -c] + args: + - | + echo "{\"kind\": \"ConfigMap\", \"apiVersion\": \"v1\", \"metadata\": { \"name\": \"$ARGOCD_APP_NAME\", \"namespace\": \"$ARGOCD_APP_NAMESPACE\", \"annotations\": {\"Foo\": \"$FOO\", \"KubeVersion\": \"$KUBE_VERSION\", \"KubeApiVersion\": \"$KUBE_API_VERSIONS\",\"Bar\": \"baz\"}}}" + # The discovery config is applied to a repository. If every configured discovery tool matches, then the plugin may be + # used to generate manifests for Applications using the repository. + # Only one of fileName, find.glob, or find.command should be specified. If multiple are specified then only the + # first (in that order) is evaluated. discover: + # fileName is a glob pattern (https://pkg.go.dev/path/filepath#Glob) that is applied to the repository's root + # directory (not the Application source directory). If there is a match, this plugin may be used for the repository. fileName: "./subdir/s*.yaml" - allowConcurrency: true - lockRepo: false + find: + # This does the same thing as fileName, but it supports double-start (nested directory) glob patterns. + glob: "**/Chart.yaml" + # The find command runs in the repository's root directory. To match, it must exit with status code 0 _and_ + # produce non-empty output to standard out. + command: [sh, -c, find . -name env.yaml] + # The parameters config describes what parameters the UI should display for an Application. It is up to the user to + # actually set parameters in the Application manifest (in spec.source.plugin.parameters). The announcements _only_ + # inform the "Parameters" tab in the App Details page of the UI. + parameters: + # Static parameter announcements are sent to the UI for _all_ Applications handled by this plugin. + # Think of the `string`, `array`, and `map` values set here as "defaults". It is up to the plugin author to make + # sure that these default values actually reflect the plugin's behavior if the user doesn't explicitly set different + # values for those parameters. + static: + - name: string-param + title: Description of the string param + tooltip: Tooltip shown when the user hovers the + # If this field is set, the UI will indicate to the user that they must set the value. + required: false + # itemType tells the UI how to present the parameter's value (or, for arrays and maps, values). Default is + # "string". Examples of other types which may be supported in the future are "boolean" or "number". + # Even if the itemType is not "string", the parameter value from the Application spec will be sent to the plugin + # as a string. It's up to the plugin to do the appropriate conversion. + itemType: "" + # collectionType describes what type of value this parameter accepts (string, array, or map) and allows the UI + # to present a form to match that type. Default is "string". + collectionType: "" + # This field communicates the parameter's default value to the UI. Setting this field is optional. + string: default-string-value + # All the fields above besides "string" apply to both the array and map type parameter announcements. + - name: array-param + # This field communicates the parameter's default value to the UI. Setting this field is optional. + array: [default, items] + - name: map-param + # This field communicates the parameter's default value to the UI. Setting this field is optional. + map: + some: value + # Dynamic parameter announcements are announcements specific to an Application handled by this plugin. For example, + # the values for a Helm chart's values.yaml file could be sent as parameter announcements. + dynamic: + # The command is run in an Application's source directory. Standard output must be JSON matching the schema of the + # static parameter announcements list. + command: [echo, '[{"name": "example-param", "string": "default-string-value"}]'] ``` !!! note While the ConfigManagementPlugin _looks like_ a Kubernetes object, it is not actually a custom resource. It only follows kubernetes-style spec conventions. -The `generate` command must print a valid YAML stream to stdout. Both `init` and `generate` commands are executed inside the application source directory. - -The `discover.fileName` is used as [glob](https://pkg.go.dev/path/filepath#Glob) pattern to determine whether an -application repository is supported by the plugin or not. - -```yaml - discover: - find: - command: [sh, -c, find . -name env.yaml] -``` - -If `discover.fileName` is not provided, the `discover.find.command` is executed in order to determine whether an -application repository is supported by the plugin or not. The `find` command should return a non-error exit code -and produce output to stdout when the application source type is supported. - -If your plugin makes use of `git` (e.g. `git crypt`), it is advised to set `lockRepo` to `true` so that your plugin will have exclusive access to the -repository at the time it is executed. Otherwise, two applications synced at the same time may result in a race condition and sync failure. - -#### 2. Place the plugin configuration file in the sidecar +### 2. Place the plugin configuration file in the sidecar Argo CD expects the plugin configuration file to be located at `/home/argocd/cmp-server/config/plugin.yaml` in the sidecar. If you use a custom image for the sidecar, you can add the file directly to that image. If you use a stock image for the sidecar or would rather maintain the plugin configuration in a ConfigMap, just nest the -plugin config file in a ConfigMap under the `plugin.yaml` key. +plugin config file in a ConfigMap under the `plugin.yaml` key and mount the ConfigMap in the sidecar (see next section). ```yaml apiVersion: v1 kind: ConfigMap metadata: - name: cmp-plugin + name: my-plugin-config data: plugin.yaml: | apiVersion: argoproj.io/v1alpha1 kind: ConfigManagementPlugin metadata: - name: cmp-plugin + name: my-plugin spec: version: v1.0 generate: command: [sh, -c, 'echo "{\"kind\": \"ConfigMap\", \"apiVersion\": \"v1\", \"metadata\": { \"name\": \"$ARGOCD_APP_NAME\", \"namespace\": \"$ARGOCD_APP_NAMESPACE\", \"annotations\": {\"Foo\": \"$FOO\", \"KubeVersion\": \"$KUBE_VERSION\", \"KubeApiVersion\": \"$KUBE_API_VERSIONS\",\"Bar\": \"baz\"}}}"'] discover: fileName: "./subdir/s*.yaml" - allowConcurrency: true - lockRepo: false ``` -#### 3. Register the plugin sidecar +### 3. Register the plugin sidecar -To install a plugin, patch argocd-repo-server to run the CMP container as a sidecar, with argocd-cmp-server as its +To install a plugin, patch argocd-repo-server to run the plugin container as a sidecar, with argocd-cmp-server as its entrypoint. You can use either off-the-shelf or custom-built plugin image as sidecar image. For example: ```yaml containers: -- name: cmp +- name: my-plugin command: [/var/run/argocd/argocd-cmp-server] # Entrypoint should be Argo CD lightweight CMP server i.e. argocd-cmp-server image: busybox # This can be off-the-shelf or custom-built image securityContext: @@ -140,11 +140,11 @@ containers: # Remove this volumeMount if you've chosen to bake the config file into the sidecar image. - mountPath: /home/argocd/cmp-server/config/plugin.yaml subPath: plugin.yaml - name: cmp-plugin + name: my-plugin-config volumes: - configMap: - name: cmp-plugin - name: cmp-plugin + name: my-plugin-config + name: my-plugin-config ``` !!! important "Double-check these items" @@ -152,38 +152,82 @@ containers: 2. Make sure that sidecar container is running as user 999. 3. Make sure that plugin configuration file is present at `/home/argocd/cmp-server/config/plugin.yaml`. It can either be volume mapped via configmap or baked into image. -### Environment +## Using environment variables in your plugin -CMP commands have access to +Plugin commands have access to 1. The system environment variables -2. [Standard build environment](build-environment.md) -3. Variables in the application spec (References to system and build variables will get interpolated in the variables' values): - -> v1.2 - -```yaml -spec: - source: - plugin: - env: - - name: FOO - value: bar - - name: REV - value: test-$ARGOCD_APP_REVISION -``` - -## Using a CMP - -If your CMP is defined in the `argocd-cm` ConfigMap, you can create a new Application using the CLI. Replace -`` with the name configured in `argocd-cm`. - -```bash -argocd app create --config-management-plugin -``` - -If your CMP is defined as a sidecar, you must manually define the Application manifest. Do not configure a `name` field -in the `plugin` section. The plugin will be automatically matched with the Application based on its discovery rules. +2. [Standard build environment variables](build-environment.md) +3. Variables in the Application spec (References to system and build variables will get interpolated in the variables' values): + + ```yaml + apiVersion: argoproj.io/v1alpha1 + kind: Application + spec: + source: + plugin: + env: + - name: FOO + value: bar + - name: REV + value: test-$ARGOCD_APP_REVISION + ``` + +4. (Starting in v2.4) Parameters in the Application spec: + + ```yaml + apiVersion: argoproj.io/v1alpha1 + kind: Application + spec: + source: + plugin: + parameters: + - name: values-files + array: [values-dev.yaml] + - name: helm-parameters + map: + image.tag: v1.2.3 + ``` + + The parameters are available as JSON in the `ARGOCD_APP_PARAMETERS` environment variable. The example above would + produce this JSON: + + ```json + [{"name": "values-files", "array": ["values-dev.yaml"]}, {"name": "helm-parameters", "map": {"image.tag": "v1.2.3"}}] + ``` + + !!! note + Parameter announcements, even if they specify defaults, are _not_ sent to the plugin in `ARGOCD_APP_PARAMETERS`. + Only parameters explicitly set in the Application spec are sent to the plugin. It is up to the plugin to apply + the same defaults as the ones announced to the UI. + + The same parameters are also available as individual environment variables. The names of the environment variables + follows this convention: + + ```yaml + - name: some-string-param + string: some-string-value + # PARAM_SOME_STRING_PARAM=some-string-value + + - name: some-array-param + value: [item1, item2] + # PARAM_SOME_ARRAY_PARAM_0=item1 + # PARAM_SOME_ARRAY_PARAM_1=item2 + + - name: some-map-param + map: + image.tag: v1.2.3 + # PARAM_SOME_MAP_PARAM_IMAGE_TAG=v1.2.3 + ``` + +!!! warning Sanitize/escape user input + As part of Argo CD's manifest generation system, config management plugins are treated with a level of trust. Be + sure to escape user input in your plugin to prevent malicious input from causing unwanted behavior. + +## Using a config management plugin with an Application + +Argo CD will automatically select the correct plugin for your Application based on the plugin's configured discovery +rules. ```yaml apiVersion: argoproj.io/v1alpha1 @@ -197,24 +241,96 @@ spec: repoURL: https://github.com/argoproj/argocd-example-apps.git targetRevision: HEAD path: guestbook - plugin: - # For either argocd-cm- or sidecar-installed CMPs, you can pass environment variables to the CMP. - env: - - name: FOO - value: bar + plugin: {} ``` -If you don't need to set any environment variables, you can set an empty plugin section. +!!! important + If your plugin's `init` or `generate` command runs too long, the command will be killed, and the UI will show an + error. The plugin server respects the timeouts set by the `server.repo.server.timeout.seconds` and + `controller.repo.server.timeout.seconds` items in `argocd-cm`. Increase their values from the default of 60s. + + Each plugin command will also independently timeout on the `ARGOCD_EXEC_TIMEOUT` set for the plugin sidecar. The + default is 90s. So if you increase the repo server timeout greater than 90s, be sure to set `ARGOCD_EXEC_TIMEOUT` + on the sidecar. + +## Migrating from argocd-cm plugins + +Installing plugins by modifying the argocd-cm ConfigMap is deprecated as of v2.4. Support will be completely removed in +a future release. + +The following will show how to convert an argocd-cm plugin to a sidecar plugin. + +### 1. Convert the ConfigMap entry into a config file + +First, copy the plugin's configuration into its own YAML file. Take for example the following ConfigMap entry: ```yaml - plugin: {} +data: + configManagementPlugins: | + - name: pluginName + init: # Optional command to initialize application source directory + command: ["sample command"] + args: ["sample args"] + generate: # Command to generate manifests YAML + command: ["sample command"] + args: ["sample args"] + lockRepo: true # Defaults to false. See below. ``` -!!! important - If your sidecar CMP command runs too long, the command will be killed, and the UI will show an error. The CMP server - respects the timeouts set by the `server.repo.server.timeout.seconds` and `controller.repo.server.timeout.seconds` - items in `argocd-cm`. Increase their values from the default of 60s. +The `pluginName` item would be converted to a config file like this: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: ConfigManagementPlugin +metadata: + name: pluginName +spec: + init: # Optional command to initialize application source directory + command: ["sample command"] + args: ["sample args"] + generate: # Command to generate manifests YAML + command: ["sample command"] + args: ["sample args"] +``` + +!!!note + The `lockRepo` key is not relevant for sidecar plugins, because sidecar plugins do not share a single source repo + directory when generating manifests. + +### 2. Write discovery rules for your plugin + +Sidecar plugins use discovery rules instead of a plugin name to match Applications to plugins. + +Write rules applicable to your plugin [using the instructions above](#1-write-the-plugin-configuration-file) and add +them to your configuration file. + +!!!important + After installing your sidecar plugin, you'll need to remove the `name` field from the plugin config in your + Application specs. For example: + + ```yaml + apiVersion: argoproj.io/v1alpha1 + kind: Application + metadata: + name: guestbook + spec: + source: + plugin: + name: pluginName # Delete this (and set `plugin: {}` if `name` was the only value). + ``` + +### 3. Make sure the plugin has access to the tools it needs + +Plugins configured with argocd-cm ran on the Argo CD image. This gave it access to all the tools installed on that +image by default (see the [Dockerfile](https://github.com/argoproj/argo-cd/blob/master/Dockerfile) for base image and +installed tools). + +You can either use a stock image (like busybox) or design your own base image with the tools your plugin needs. For +security, avoid using image with more binaries installed than what your plugin actually needs. + +### 4. Test the plugin + +After installing the plugin as a sidecar [according to the directions above](#installing-a-config-management-plugin), +test it out on a few Applications before migrating all of them to the sidecar plugin. - Each CMP command will also independently timeout on the `ARGOCD_EXEC_TIMEOUT` set for the CMP sidecar. The default - is 90s. So if you increase the repo server timeout greater than 90s, be sure to set `ARGOCD_EXEC_TIMEOUT` on the - sidecar. +Once tests have checked out, remove the plugin entry from your argocd-cm ConfigMap. diff --git a/examples/plugins/helm/generate.sh b/examples/plugins/helm/generate.sh index db93c36de9098..c382b78b1c6ad 100755 --- a/examples/plugins/helm/generate.sh +++ b/examples/plugins/helm/generate.sh @@ -1,5 +1,6 @@ #!/bin/sh + ARGUMENTS=$(echo "$ARGOCD_APP_PARAMETERS" | jq -r '.[] | select(.name == "values-files").array | .[] | "--values=" + .') PARAMETERS=$(echo "$ARGOCD_APP_PARAMETERS" | jq -r '.[] | select(.name == "helm-parameters").map | to_entries | map("\(.key)=\(.value)") | .[] | "--set=" + .') -ARGUMENTS="$ARGUMENTS\n$PARAMETERS" -echo "$ARGUMENTS" | xargs helm template . + +echo ". $ARGUMENTS $PARAMETERS" | xargs helm template diff --git a/examples/plugins/helm/get-parameters.sh b/examples/plugins/helm/get-parameters.sh index 57290acb2e8e4..d89c29c46656e 100755 --- a/examples/plugins/helm/get-parameters.sh +++ b/examples/plugins/helm/get-parameters.sh @@ -1,9 +1,8 @@ #!/bin/sh -echo " -[{ - \"name\": \"helm-parameters\", - \"title\": \"Helm Parameters\", - \"collectionType\": \"map\", - \"map\": $(yq e -o=json values.yaml | jq '[leaf_paths as $path | {"key": $path | join("."), "value": getpath($path)|tostring}] | from_entries') - }]" | tr -d "\n" +yq e -o=json values.yaml | jq '{ + name: "helm-parameters", + title: "Helm Parameters", + collectionType: "map", + map: [leaf_paths as $path | {"key": $path | join("."), "value": getpath($path)|tostring}] | from_entries +}' diff --git a/reposerver/repository/repository.go b/reposerver/repository/repository.go index dc942d766b7e7..b91bf6db30e5b 100644 --- a/reposerver/repository/repository.go +++ b/reposerver/repository/repository.go @@ -1577,23 +1577,8 @@ func populatePluginAppDetails(ctx context.Context, res *apiclient.RepoAppDetails return fmt.Errorf("failed to get parameter anouncement: %w", err) } - // TODO: share types so conversion is unnecessary. - var announcementConverted []*apiclient.ParameterAnnouncement - for _, pluginAnnouncement := range announcement.ParameterAnnouncements { - announcementConverted = append(announcementConverted, &apiclient.ParameterAnnouncement{ - Name: pluginAnnouncement.Name, - Title: pluginAnnouncement.Title, - Tooltip: pluginAnnouncement.Tooltip, - Required: pluginAnnouncement.Required, - ItemType: pluginAnnouncement.ItemType, - CollectionType: pluginAnnouncement.CollectionType, - String_: pluginAnnouncement.String_, - Array: pluginAnnouncement.Array, - Map: pluginAnnouncement.Map, - }) - } res.Plugin = &apiclient.PluginAppSpec{ - ParametersAnnouncement: announcementConverted, + ParametersAnnouncement: announcement.ParameterAnnouncements, } return nil } diff --git a/reposerver/repository/repository.proto b/reposerver/repository/repository.proto index e81792e20a295..5754443d85ccb 100644 --- a/reposerver/repository/repository.proto +++ b/reposerver/repository/repository.proto @@ -171,7 +171,6 @@ message PluginAppSpec { repeated ParameterAnnouncement parametersAnnouncement = 1; } - message HelmChartsRequest { github.com.argoproj.argo_cd.v2.pkg.apis.application.v1alpha1.Repository repo = 1; }