-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
262 changed files
with
4,171 additions
and
1,307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Config for Stalebot, limited to only `issues` | ||
only: issues | ||
|
||
# Issues config | ||
issues: | ||
daysUntilStale: 60 | ||
daysUntilClose: 7 | ||
|
||
# Limit the number of actions per hour, from 1-30. Default is 30 | ||
limitPerRun: 30 | ||
|
||
# Issues with these labels will never be considered stale | ||
exemptLabels: | ||
- kind/enhancement | ||
- kind/feature | ||
- kind/question | ||
- kind/style | ||
- bug/need-confirmation | ||
- bug/confirmed | ||
- status/discuss | ||
|
||
# Only issues with all of these labels are checked if stale. Defaults to `[]` (disabled) | ||
onlyLabels: [] | ||
|
||
# Set to true to ignore issues in a project (defaults to false) | ||
exemptProjects: true | ||
# Set to true to ignore issues in a milestone (defaults to false) | ||
exemptMilestones: true | ||
# Set to true to ignore issues with an assignee (defaults to false) | ||
exemptAssignees: true | ||
|
||
# Label to use when marking an issue as stale | ||
staleLabel: status/stale | ||
|
||
# Comment to post when marking an issue as stale. Set to `false` to disable | ||
markComment: > | ||
This issue has been marked as stale as it has not had recent activity, | ||
it will be closed if no further activity occurs in the next 7 days. | ||
If you believe that it has been incorrectly labelled as stale, | ||
leave a comment and the label will be removed. | ||
# Comment to post when removing the stale label. | ||
# unmarkComment: > | ||
# Your comment here. | ||
|
||
# Comment to post when closing a stale issue. Set to `false` to disable | ||
closeComment: > | ||
Since no further activity has appeared on this issue it will be closed. | ||
If you believe that it has been incorrectly closed, leave a comment | ||
and mention @itsconquest. One of our staff will then review the issue. | ||
Note - If it is an old bug report, make sure that it is reproduceable in the | ||
latest version of Portainer as it may have already been fixed. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package migrator | ||
|
||
import portainer "github.com/portainer/portainer/api" | ||
|
||
func (m *Migrator) updateSettingsToDBVersion19() error { | ||
legacySettings, err := m.settingsService.Settings() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if legacySettings.EdgeAgentCheckinInterval == 0 { | ||
legacySettings.EdgeAgentCheckinInterval = portainer.DefaultEdgeAgentCheckinIntervalInSeconds | ||
} | ||
|
||
return m.settingsService.UpdateSettings(legacySettings) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package tunnelserver | ||
|
||
import ( | ||
"github.com/portainer/portainer/api" | ||
"github.com/portainer/portainer/api/bolt/internal" | ||
|
||
"github.com/boltdb/bolt" | ||
) | ||
|
||
const ( | ||
// BucketName represents the name of the bucket where this service stores data. | ||
BucketName = "tunnel_server" | ||
infoKey = "INFO" | ||
) | ||
|
||
// Service represents a service for managing endpoint data. | ||
type Service struct { | ||
db *bolt.DB | ||
} | ||
|
||
// NewService creates a new instance of a service. | ||
func NewService(db *bolt.DB) (*Service, error) { | ||
err := internal.CreateBucket(db, BucketName) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &Service{ | ||
db: db, | ||
}, nil | ||
} | ||
|
||
// Info retrieve the TunnelServerInfo object. | ||
func (service *Service) Info() (*portainer.TunnelServerInfo, error) { | ||
var info portainer.TunnelServerInfo | ||
|
||
err := internal.GetObject(service.db, BucketName, []byte(infoKey), &info) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &info, nil | ||
} | ||
|
||
// UpdateInfo persists a TunnelServerInfo object. | ||
func (service *Service) UpdateInfo(settings *portainer.TunnelServerInfo) error { | ||
return internal.UpdateObject(service.db, BucketName, []byte(infoKey), settings) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package chisel | ||
|
||
import ( | ||
"encoding/base64" | ||
"fmt" | ||
"strconv" | ||
"strings" | ||
) | ||
|
||
// GenerateEdgeKey will generate a key that can be used by an Edge agent to register with a Portainer instance. | ||
// The key represents the following data in this particular format: | ||
// portainer_instance_url|tunnel_server_addr|tunnel_server_fingerprint|endpoint_ID | ||
// The key returned by this function is a base64 encoded version of the data. | ||
func (service *Service) GenerateEdgeKey(url, host string, endpointIdentifier int) string { | ||
keyInformation := []string{ | ||
url, | ||
fmt.Sprintf("%s:%s", host, service.serverPort), | ||
service.serverFingerprint, | ||
strconv.Itoa(endpointIdentifier), | ||
} | ||
|
||
key := strings.Join(keyInformation, "|") | ||
return base64.RawStdEncoding.EncodeToString([]byte(key)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package chisel | ||
|
||
import ( | ||
"strconv" | ||
|
||
portainer "github.com/portainer/portainer/api" | ||
) | ||
|
||
// AddSchedule register a schedule inside the tunnel details associated to an endpoint. | ||
func (service *Service) AddSchedule(endpointID portainer.EndpointID, schedule *portainer.EdgeSchedule) { | ||
tunnel := service.GetTunnelDetails(endpointID) | ||
|
||
existingScheduleIndex := -1 | ||
for idx, existingSchedule := range tunnel.Schedules { | ||
if existingSchedule.ID == schedule.ID { | ||
existingScheduleIndex = idx | ||
break | ||
} | ||
} | ||
|
||
if existingScheduleIndex == -1 { | ||
tunnel.Schedules = append(tunnel.Schedules, *schedule) | ||
} else { | ||
tunnel.Schedules[existingScheduleIndex] = *schedule | ||
} | ||
|
||
key := strconv.Itoa(int(endpointID)) | ||
service.tunnelDetailsMap.Set(key, tunnel) | ||
} | ||
|
||
// RemoveSchedule will remove the specified schedule from each tunnel it was registered with. | ||
func (service *Service) RemoveSchedule(scheduleID portainer.ScheduleID) { | ||
for item := range service.tunnelDetailsMap.IterBuffered() { | ||
tunnelDetails := item.Val.(*portainer.TunnelDetails) | ||
|
||
updatedSchedules := make([]portainer.EdgeSchedule, 0) | ||
for _, schedule := range tunnelDetails.Schedules { | ||
if schedule.ID == scheduleID { | ||
continue | ||
} | ||
updatedSchedules = append(updatedSchedules, schedule) | ||
} | ||
|
||
tunnelDetails.Schedules = updatedSchedules | ||
service.tunnelDetailsMap.Set(item.Key, tunnelDetails) | ||
} | ||
} |
Oops, something went wrong.