Documentation ¶
Overview ¶
Package common provides functions and structs used by multiple Nafigos services for interacting with Kubernetes clusters, NATS queues, and other services
Index ¶
- Variables
- func CreateCloudEvent(request []byte, eventType string, source string, id string) ([]byte, error)
- func CreateResourceName(username, name, id string) string
- func FixName(name string) string
- func GetDNS1123Name(name string) (dns1123Name string, err error)
- func GetNATSInfo(defaultClusterID string, defaultClientID string, defaultConnAddress string) map[string]string
- func GetRequestFromCloudEvent(msg []byte) (dataBytes []byte, err error)
- func PublishRequest(request Request, subject string, source string, connAddress string) (result []byte, err error)
- func RegisterMonitoring(subject string, natsInfo map[string]string)
- func StanQueueSubscriber(subject string, queue string, cb stan.MsgHandler, natsInfo map[string]string, ...)
- func StanSubscriber(subject string, cb stan.MsgHandler, natsInfo map[string]string, ...)
- func StreamingPublish(request []byte, natsInfo map[string]string, subject string, source string) error
- func StreamingQueueSubscriber(subject string, queue string, action func([]byte, map[string]string), ...)
- func StreamingSubscriber(subject string, action func([]byte, map[string]string), ...)
- func StreamingTestSubscriber(subject string, queue string, action func([]byte, map[string]string), ...)
- func SynchronousSubscriber(subject string, queue string, ...)
- func SynchronousTestSubscriber(subject string, queue string, ...)
- type BasicRequest
- func (r *BasicRequest) GetBuildID() string
- func (r *BasicRequest) GetClusterID() string
- func (r *BasicRequest) GetError() Error
- func (r *BasicRequest) GetGitSecretID() string
- func (r *BasicRequest) GetRedacted() BasicRequest
- func (r *BasicRequest) GetRegistrySecretID() string
- func (r *BasicRequest) GetRunID() string
- func (r *BasicRequest) GetUser() User
- func (r *BasicRequest) GetWorkflowID() string
- func (r *BasicRequest) SetBuildID(value string)
- func (r *BasicRequest) SetClusterID(value string)
- func (r *BasicRequest) SetGitSecretID(value string)
- func (r *BasicRequest) SetRegistrySecretID(value string)
- func (r *BasicRequest) SetRunID(value string)
- func (r *BasicRequest) SetUser(value User)
- func (r *BasicRequest) SetWorkflowID(value string)
- type BuildStatus
- type BuildStep
- type CRUD
- type Cluster
- type DatabaseAdapter
- func (d DatabaseAdapter) Create(collectionName string, document NafigosBase) (err error)
- func (d DatabaseAdapter) Delete(collectionName, id string) (err error)
- func (d DatabaseAdapter) GetMock() (m *mock.Mock)
- func (d DatabaseAdapter) Read(collectionName string, id string) (data []byte, err error)
- func (d DatabaseAdapter) ReadFor(collectionName, key, value string) (results []map[string]interface{}, err error)
- func (d DatabaseAdapter) ReadForUser(collectionName, owner string) (results []map[string]interface{}, err error)
- func (d DatabaseAdapter) Replace(collectionName string, document NafigosBase) (err error)
- func (d DatabaseAdapter) Update(collectionName string, document NafigosBase) (err error)
- type Error
- type K8sClientsets
- func (o *K8sClientsets) ApproveCertificateSigningRequest(approval *certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error)
- func (o *K8sClientsets) CanI(verb, resource string) (bool, error)
- func (o *K8sClientsets) CreateArgoWorkflow(workflow *argotypes.Workflow, namespace string) (*argotypes.Workflow, error)
- func (o *K8sClientsets) CreateAuthorizationPolicy(policy *istiosec.AuthorizationPolicy, namespace string) (*istiosec.AuthorizationPolicy, error)
- func (o *K8sClientsets) CreateCertificateSigningRequest(csr *certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error)
- func (o *K8sClientsets) CreateClusterRole(cr *rbac.ClusterRole) (*rbac.ClusterRole, error)
- func (o *K8sClientsets) CreateDeployment(deployment *appsv1.Deployment, namespace string) (*appsv1.Deployment, error)
- func (o *K8sClientsets) CreateDestinationRule(dr *istio.DestinationRule, namespace string) (*istio.DestinationRule, error)
- func (o *K8sClientsets) CreateFunction(fn *openfaas.Function, namespace string) (*openfaas.Function, error)
- func (o *K8sClientsets) CreateGateway(gateway *istio.Gateway, namespace string) (*istio.Gateway, error)
- func (o *K8sClientsets) CreateInformer(namespace string, handlers cache.ResourceEventHandlerFuncs) cache.SharedIndexInformer
- func (o *K8sClientsets) CreateJob(job *batch.Job, namespace string) (*batch.Job, error)
- func (o *K8sClientsets) CreateNamespace(ns *v1.Namespace) (*v1.Namespace, error)
- func (o *K8sClientsets) CreatePods(pod *v1.Pod, namespace string) (*v1.Pod, error)
- func (o *K8sClientsets) CreateRequestAuthentication(requestAuthentication *istiosec.RequestAuthentication, namespace string) (*istiosec.RequestAuthentication, error)
- func (o *K8sClientsets) CreateRole(role *rbac.Role, namespace string) (*rbac.Role, error)
- func (o *K8sClientsets) CreateRoleBinding(rolebinding *rbac.RoleBinding, namespace string) (*rbac.RoleBinding, error)
- func (o *K8sClientsets) CreateScaledObject(scaledObject *unstructured.Unstructured, namespace string) (*unstructured.Unstructured, error)
- func (o *K8sClientsets) CreateSecret(secret *v1.Secret, namespace string) (*v1.Secret, error)
- func (o *K8sClientsets) CreateService(service *v1.Service, namespace string) (*v1.Service, error)
- func (o *K8sClientsets) CreateServiceEntry(se *istio.ServiceEntry, namespace string) (*istio.ServiceEntry, error)
- func (o *K8sClientsets) CreateVirtualService(vs *istio.VirtualService, namespace string) (*istio.VirtualService, error)
- func (o *K8sClientsets) DeleteArgoWorkflow(name, namespace string) error
- func (o *K8sClientsets) DeleteAuthorizationPolicy(name, namespace string) error
- func (o *K8sClientsets) DeleteCertificateSigningRequest(name string) error
- func (o *K8sClientsets) DeleteDeployment(name, namespace string) error
- func (o *K8sClientsets) DeleteDestinationRule(name, namespace string) error
- func (o *K8sClientsets) DeleteFunction(name, namespace string) error
- func (o *K8sClientsets) DeleteGateway(name, namespace string) error
- func (o *K8sClientsets) DeleteJob(name, namespace string) error
- func (o *K8sClientsets) DeletePods(name, namespace string) error
- func (o *K8sClientsets) DeleteRequestAuthentication(name, namespace string) error
- func (o *K8sClientsets) DeleteScaledObject(name, namespace string) error
- func (o *K8sClientsets) DeleteSecret(name, namespace string) error
- func (o *K8sClientsets) DeleteService(name, namespace string) error
- func (o *K8sClientsets) DeleteServiceEntry(name, namespace string) error
- func (o *K8sClientsets) DeleteVirtualService(name, namespace string) error
- func (o *K8sClientsets) GetArgoWorkflow(name, namespace string) (*argotypes.Workflow, error)
- func (o *K8sClientsets) GetCertificateSigningRequest(name string) (*certificates.CertificateSigningRequest, error)
- func (o *K8sClientsets) GetDeployment(name, namespace string) (*appsv1.Deployment, error)
- func (o *K8sClientsets) GetJob(name, namespace string) (*batch.Job, error)
- func (o *K8sClientsets) GetLogs(name, namespace string) ([]byte, error)
- func (o *K8sClientsets) GetPods(name, namespace string) (*v1.Pod, error)
- func (o *K8sClientsets) GetService(name, namespace string) (*v1.Service, error)
- func (o *K8sClientsets) ListArgoWorkflows(options metav1.ListOptions, namespace string) (*argotypes.WorkflowList, error)
- func (o *K8sClientsets) ListDeployments(options metav1.ListOptions, namespace string) (*appsv1.DeploymentList, error)
- func (o *K8sClientsets) ListJobs(options metav1.ListOptions, namespace string) (*batch.JobList, error)
- func (o *K8sClientsets) ListPods(options metav1.ListOptions, namespace string) (*v1.PodList, error)
- func (o *K8sClientsets) ScaleDeployment(name, namespace string, replicas int32) error
- func (o *K8sClientsets) UpdateArgoWorkflow(workflow *argotypes.Workflow, namespace string) (*argotypes.Workflow, error)
- func (o *K8sClientsets) UpdateDeployment(deployment *appsv1.Deployment, namespace string) (*appsv1.Deployment, error)
- func (o *K8sClientsets) UpdateDestinationRule(dr *istio.DestinationRule, namespace string) (*istio.DestinationRule, error)
- func (o *K8sClientsets) UpdateGateway(gateway *istio.Gateway, namespace string) (*istio.Gateway, error)
- func (o *K8sClientsets) UpdateJob(job *batch.Job, namespace string) (*batch.Job, error)
- func (o *K8sClientsets) UpdateScaledObject(scaledObject *unstructured.Unstructured, namespace string) (*unstructured.Unstructured, error)
- func (o *K8sClientsets) UpdateSecret(secret *v1.Secret, namespace string) (*v1.Secret, error)
- func (o *K8sClientsets) UpdateService(service *v1.Service, namespace string) (*v1.Service, error)
- func (o *K8sClientsets) UpdateServiceEntry(se *istio.ServiceEntry, namespace string) (*istio.ServiceEntry, error)
- func (o *K8sClientsets) UpdateVirtualService(vs *istio.VirtualService, namespace string) (*istio.VirtualService, error)
- type MockedAdapter
- func (d MockedAdapter) Create(collectionName string, document NafigosBase) error
- func (d MockedAdapter) Delete(collectionName, id string) error
- func (d MockedAdapter) GetMock() *mock.Mock
- func (d MockedAdapter) Read(collectionName, id string) ([]byte, error)
- func (d MockedAdapter) ReadFor(collectionName, key, value string) ([]map[string]interface{}, error)
- func (d MockedAdapter) ReadForUser(collectionName, owner string) ([]map[string]interface{}, error)
- func (d MockedAdapter) Replace(collectionName string, document NafigosBase) error
- func (d MockedAdapter) Update(collectionName string, document NafigosBase) error
- type NafigosBase
- type Repository
- type Request
- type Secret
- type SecretType
- type User
Constants ¶
This section is empty.
Variables ¶
var MonitoringSubject = "Phylax.CreateSubscriber"
MonitoringSubject is the subject phylax monitors for creating subscribers
Functions ¶
func CreateCloudEvent ¶
CreateCloudEvent takes a JSON byte slice and uses it as the data for a new CloudEvent object Marshaled as a JSON byte slice
func CreateResourceName ¶
CreateResourceName is used to create a K8s resource name that is both unique and informative to users:
<username:limit to 8>-<name:limit to 32 chars>-<xid>
func GetDNS1123Name ¶
GetDNS1123Name accepts a string a returns a version of that string that is compatible with DNS 1123. It replaces all underscores with hyphens to preserve readability and then strips anything that does not conform to then regex for the standard.
func GetNATSInfo ¶
func GetNATSInfo(defaultClusterID string, defaultClientID string, defaultConnAddress string) map[string]string
GetNATSInfo returns a map containing necessary NATS connection variables. It is used to get this information from environment variables or use the defaults
func GetRequestFromCloudEvent ¶
GetRequestFromCloudEvent will unmarshal a CloudEvent object and unmarshal the data field into JSON bytes
func PublishRequest ¶
func PublishRequest(request Request, subject string, source string, connAddress string) (result []byte, err error)
PublishRequest can be used to create a CloudEvent and publish it on NATS. It expects a reply
func RegisterMonitoring ¶
RegisterMonitoring is used to monitor a separate streaming channel
func StanQueueSubscriber ¶
func StanQueueSubscriber(subject string, queue string, cb stan.MsgHandler, natsInfo map[string]string, wg *sync.WaitGroup)
StanQueueSubscriber creates a NATS Streaming Subscriber that will listen on a subject as a queue subscriber and perform asynchronous actions. The cb parameter can by any function which conforms to the stan.MsgHandler type (i.e. accepts *stan.Msg as a parameter). For information on queue subscribers, see https://docs.nats.io/developing-with-nats-streaming/queues
func StanSubscriber ¶
func StanSubscriber(subject string, cb stan.MsgHandler, natsInfo map[string]string, wg *sync.WaitGroup)
StanSubscriber creates a NATS Streaming Subscriber that will listen on a subject and perform asynchronous actions. The cb parameter can by any function which conforms to the stan.MsgHandler type (i.e. accepts *stan.Msg as a parameter)
func StreamingPublish ¶
func StreamingPublish(request []byte, natsInfo map[string]string, subject string, source string) error
StreamingPublish can be used to create a CloudEvent and publish it on NATS Streaming
func StreamingQueueSubscriber ¶
func StreamingQueueSubscriber(subject string, queue string, action func([]byte, map[string]string), natsInfo map[string]string, wg *sync.WaitGroup)
StreamingQueueSubscriber creates a NATS Streaming Queue Subscriber that will listen on a subject and perform asynchronous actions. The action function should accept a []byte that represents JSON data, and a map[string]string, which represents NATS connection info.
func StreamingSubscriber ¶
func StreamingSubscriber(subject string, action func([]byte, map[string]string), natsInfo map[string]string, wg *sync.WaitGroup)
StreamingSubscriber creates a NATS Streaming Subscriber that will listen on a subject and perform asynchronous actions. The action function should accept a []byte that represents JSON data, and a map[string]string, which represents NATS connection info.
func StreamingTestSubscriber ¶
func StreamingTestSubscriber(subject string, queue string, action func([]byte, map[string]string), natsInfo map[string]string, wg *sync.WaitGroup)
StreamingTestSubscriber is the same as StreamingSubscriber but will exit after receiving and processing one request
func SynchronousSubscriber ¶
func SynchronousSubscriber(subject string, queue string, action func([]byte, *nats.Msg, map[string]string), natsInfo map[string]string, wg *sync.WaitGroup)
SynchronousSubscriber is used to synchronously respond to requests
func SynchronousTestSubscriber ¶
func SynchronousTestSubscriber(subject string, queue string, action func([]byte, *nats.Msg, map[string]string), natsInfo map[string]string, wg *sync.WaitGroup)
SynchronousTestSubscriber is the same as SynchronousSubscriber but will exit after receiving and processing one request
Types ¶
type BasicRequest ¶
type BasicRequest struct { User User `json:"user,omitempty"` ClusterID string `json:"cluster_id,omitempty"` RegistrySecretID string `json:"registry_secret_id,omitempty"` GitSecretID string `json:"git_secret_id,omitempty"` WorkflowID string `json:"workflow_id,omitempty"` BuildID string `json:"build_id,omitempty"` RunID string `json:"run_id,omitempty"` Error Error `json:"error,omitempty"` }
BasicRequest is the simplest implementation of the Request interface and is intended to be included as an embedded/anonymous struct in extending types
func (*BasicRequest) GetGitSecretID ¶
func (r *BasicRequest) GetGitSecretID() string
GetGitSecretID ...
func (*BasicRequest) GetRedacted ¶
func (r *BasicRequest) GetRedacted() BasicRequest
GetRedacted will return a new BasicRequest with the confidential fields removed from the User's Secrets and Clusters
func (*BasicRequest) GetRegistrySecretID ¶
func (r *BasicRequest) GetRegistrySecretID() string
GetRegistrySecretID ...
func (*BasicRequest) GetWorkflowID ¶
func (r *BasicRequest) GetWorkflowID() string
GetWorkflowID ...
func (*BasicRequest) SetClusterID ¶
func (r *BasicRequest) SetClusterID(value string)
SetClusterID ...
func (*BasicRequest) SetGitSecretID ¶
func (r *BasicRequest) SetGitSecretID(value string)
SetGitSecretID ...
func (*BasicRequest) SetRegistrySecretID ¶
func (r *BasicRequest) SetRegistrySecretID(value string)
SetRegistrySecretID ...
func (*BasicRequest) SetWorkflowID ¶
func (r *BasicRequest) SetWorkflowID(value string)
SetWorkflowID ...
type BuildStatus ¶
type BuildStatus struct { Complete bool `json:"complete"` Success bool `json:"success"` Info string `json:"info"` }
BuildStatus is used to get information about a Build. Info will be a container's output log
type BuildStep ¶
type BuildStep struct { Image string `bson:"image" json:"image,omitempty" yaml:"image,omitempty"` Dockerfile string `bson:"dockerfile" json:"dockerfile,omitempty" yaml:"dockerfile,omitempty"` Args []core.EnvVar `bson:"args" json:"args,omitempty" yaml:"args,omitempty"` }
BuildStep ...
type CRUD ¶
type CRUD interface { GetMock() *mock.Mock Create(string, NafigosBase) error Read(string, string) ([]byte, error) Update(string, NafigosBase) error Replace(string, NafigosBase) error Delete(string, string) error ReadFor(string, string, string) ([]map[string]interface{}, error) ReadForUser(string, string) ([]map[string]interface{}, error) }
CRUD is an interface that allows for mocking of the MongoDB
type Cluster ¶
type Cluster struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` DefaultNamespace string `json:"default_namespace,omitempty"` Config string `json:"config,omitempty"` Host string `json:"host,omitempty"` Slug string `json:"slug,omitempty"` Admin bool `json:"admin,omitempty"` }
Cluster ...
func (*Cluster) GetRedacted ¶
GetRedacted will return a new Cluster with the Value set to "REDACTED"
type DatabaseAdapter ¶
DatabaseAdapter implements the CRUD interface to allow for mocking
func GetMongoDBAdapter ¶
func GetMongoDBAdapter(name, address string) (adapter DatabaseAdapter, err error)
GetMongoDBAdapter returns a new connection to MongoDB and wraps it in a CRUD interface
func (DatabaseAdapter) Create ¶
func (d DatabaseAdapter) Create(collectionName string, document NafigosBase) (err error)
Create will insert into the database
func (DatabaseAdapter) Delete ¶
func (d DatabaseAdapter) Delete(collectionName, id string) (err error)
Delete will delete from the database
func (DatabaseAdapter) Read ¶
func (d DatabaseAdapter) Read(collectionName string, id string) (data []byte, err error)
Read will read from the database
func (DatabaseAdapter) ReadFor ¶
func (d DatabaseAdapter) ReadFor(collectionName, key, value string) (results []map[string]interface{}, err error)
ReadFor will return all objects with a key
func (DatabaseAdapter) ReadForUser ¶
func (d DatabaseAdapter) ReadForUser(collectionName, owner string) (results []map[string]interface{}, err error)
ReadForUser will return all objects owned by a user
func (DatabaseAdapter) Replace ¶
func (d DatabaseAdapter) Replace(collectionName string, document NafigosBase) (err error)
Replace will save/replace an existing object in the database
func (DatabaseAdapter) Update ¶
func (d DatabaseAdapter) Update(collectionName string, document NafigosBase) (err error)
Update wil update/edit in the database
type Error ¶
Error is used for responding to synchronous requests with an error that is JSON friendly
type K8sClientsets ¶
type K8sClientsets struct {
// contains filtered or unexported fields
}
K8sClientsets contains all the necessary clientsets for creating resources in K8s
func NewServiceClusterK8sClientsets ¶
func NewServiceClusterK8sClientsets() (*K8sClientsets, error)
NewServiceClusterK8sClientsets creates clientsets necessary for creating Kubernetes objects on the cluster this program is currently running on
func NewTestK8sClientsets ¶
func NewTestK8sClientsets() (*K8sClientsets, error)
NewTestK8sClientsets is used to create mock clientsets for testing
func NewUserClusterK8sClientsets ¶
func NewUserClusterK8sClientsets(configString string) (*K8sClientsets, error)
NewUserClusterK8sClientsets creates clientsets necessary for creating Kubernetes objects on a user's cluster using the provided config
func (*K8sClientsets) ApproveCertificateSigningRequest ¶
func (o *K8sClientsets) ApproveCertificateSigningRequest(approval *certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error)
ApproveCertificateSigningRequest ...
func (*K8sClientsets) CanI ¶
func (o *K8sClientsets) CanI(verb, resource string) (bool, error)
CanI checks if an verb can be performed on a resource
func (*K8sClientsets) CreateArgoWorkflow ¶
func (o *K8sClientsets) CreateArgoWorkflow(workflow *argotypes.Workflow, namespace string) (*argotypes.Workflow, error)
CreateArgoWorkflow ...
func (*K8sClientsets) CreateAuthorizationPolicy ¶
func (o *K8sClientsets) CreateAuthorizationPolicy(policy *istiosec.AuthorizationPolicy, namespace string) (*istiosec.AuthorizationPolicy, error)
CreateAuthorizationPolicy ...
func (*K8sClientsets) CreateCertificateSigningRequest ¶
func (o *K8sClientsets) CreateCertificateSigningRequest(csr *certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error)
CreateCertificateSigningRequest ...
func (*K8sClientsets) CreateClusterRole ¶
func (o *K8sClientsets) CreateClusterRole(cr *rbac.ClusterRole) (*rbac.ClusterRole, error)
CreateClusterRole ...
func (*K8sClientsets) CreateDeployment ¶
func (o *K8sClientsets) CreateDeployment(deployment *appsv1.Deployment, namespace string) (*appsv1.Deployment, error)
CreateDeployment ...
func (*K8sClientsets) CreateDestinationRule ¶
func (o *K8sClientsets) CreateDestinationRule(dr *istio.DestinationRule, namespace string) (*istio.DestinationRule, error)
CreateDestinationRule ...
func (*K8sClientsets) CreateFunction ¶
func (o *K8sClientsets) CreateFunction(fn *openfaas.Function, namespace string) (*openfaas.Function, error)
CreateFunction ...
func (*K8sClientsets) CreateGateway ¶
func (o *K8sClientsets) CreateGateway(gateway *istio.Gateway, namespace string) (*istio.Gateway, error)
CreateGateway ...
func (*K8sClientsets) CreateInformer ¶
func (o *K8sClientsets) CreateInformer(namespace string, handlers cache.ResourceEventHandlerFuncs) cache.SharedIndexInformer
CreateInformer creates a SharedIndexInformer on the specified namespace and with the attached handlers.
func (*K8sClientsets) CreateNamespace ¶
CreateNamespace ...
func (*K8sClientsets) CreatePods ¶
CreatePods ...
func (*K8sClientsets) CreateRequestAuthentication ¶
func (o *K8sClientsets) CreateRequestAuthentication(requestAuthentication *istiosec.RequestAuthentication, namespace string) (*istiosec.RequestAuthentication, error)
CreateRequestAuthentication ...
func (*K8sClientsets) CreateRole ¶
CreateRole ...
func (*K8sClientsets) CreateRoleBinding ¶
func (o *K8sClientsets) CreateRoleBinding(rolebinding *rbac.RoleBinding, namespace string) (*rbac.RoleBinding, error)
CreateRoleBinding ...
func (*K8sClientsets) CreateScaledObject ¶
func (o *K8sClientsets) CreateScaledObject(scaledObject *unstructured.Unstructured, namespace string) (*unstructured.Unstructured, error)
CreateScaledObject ...
func (*K8sClientsets) CreateSecret ¶
CreateSecret ...
func (*K8sClientsets) CreateService ¶
CreateService ...
func (*K8sClientsets) CreateServiceEntry ¶
func (o *K8sClientsets) CreateServiceEntry(se *istio.ServiceEntry, namespace string) (*istio.ServiceEntry, error)
CreateServiceEntry ...
func (*K8sClientsets) CreateVirtualService ¶
func (o *K8sClientsets) CreateVirtualService(vs *istio.VirtualService, namespace string) (*istio.VirtualService, error)
CreateVirtualService ...
func (*K8sClientsets) DeleteArgoWorkflow ¶
func (o *K8sClientsets) DeleteArgoWorkflow(name, namespace string) error
DeleteArgoWorkflow ...
func (*K8sClientsets) DeleteAuthorizationPolicy ¶
func (o *K8sClientsets) DeleteAuthorizationPolicy(name, namespace string) error
DeleteAuthorizationPolicy ...
func (*K8sClientsets) DeleteCertificateSigningRequest ¶
func (o *K8sClientsets) DeleteCertificateSigningRequest(name string) error
DeleteCertificateSigningRequest ...
func (*K8sClientsets) DeleteDeployment ¶
func (o *K8sClientsets) DeleteDeployment(name, namespace string) error
DeleteDeployment ...
func (*K8sClientsets) DeleteDestinationRule ¶
func (o *K8sClientsets) DeleteDestinationRule(name, namespace string) error
DeleteDestinationRule ...
func (*K8sClientsets) DeleteFunction ¶
func (o *K8sClientsets) DeleteFunction(name, namespace string) error
DeleteFunction ...
func (*K8sClientsets) DeleteGateway ¶
func (o *K8sClientsets) DeleteGateway(name, namespace string) error
DeleteGateway ...
func (*K8sClientsets) DeleteJob ¶
func (o *K8sClientsets) DeleteJob(name, namespace string) error
DeleteJob ...
func (*K8sClientsets) DeletePods ¶
func (o *K8sClientsets) DeletePods(name, namespace string) error
DeletePods ...
func (*K8sClientsets) DeleteRequestAuthentication ¶
func (o *K8sClientsets) DeleteRequestAuthentication(name, namespace string) error
DeleteRequestAuthentication ...
func (*K8sClientsets) DeleteScaledObject ¶
func (o *K8sClientsets) DeleteScaledObject(name, namespace string) error
DeleteScaledObject ...
func (*K8sClientsets) DeleteSecret ¶
func (o *K8sClientsets) DeleteSecret(name, namespace string) error
DeleteSecret ...
func (*K8sClientsets) DeleteService ¶
func (o *K8sClientsets) DeleteService(name, namespace string) error
DeleteService ...
func (*K8sClientsets) DeleteServiceEntry ¶
func (o *K8sClientsets) DeleteServiceEntry(name, namespace string) error
DeleteServiceEntry ...
func (*K8sClientsets) DeleteVirtualService ¶
func (o *K8sClientsets) DeleteVirtualService(name, namespace string) error
DeleteVirtualService ...
func (*K8sClientsets) GetArgoWorkflow ¶
func (o *K8sClientsets) GetArgoWorkflow(name, namespace string) (*argotypes.Workflow, error)
GetArgoWorkflow ...
func (*K8sClientsets) GetCertificateSigningRequest ¶
func (o *K8sClientsets) GetCertificateSigningRequest(name string) (*certificates.CertificateSigningRequest, error)
GetCertificateSigningRequest ...
func (*K8sClientsets) GetDeployment ¶
func (o *K8sClientsets) GetDeployment(name, namespace string) (*appsv1.Deployment, error)
GetDeployment ...
func (*K8sClientsets) GetJob ¶
func (o *K8sClientsets) GetJob(name, namespace string) (*batch.Job, error)
GetJob ...
func (*K8sClientsets) GetLogs ¶
func (o *K8sClientsets) GetLogs(name, namespace string) ([]byte, error)
GetLogs ...
func (*K8sClientsets) GetPods ¶
func (o *K8sClientsets) GetPods(name, namespace string) (*v1.Pod, error)
GetPods ...
func (*K8sClientsets) GetService ¶
func (o *K8sClientsets) GetService(name, namespace string) (*v1.Service, error)
GetService ...
func (*K8sClientsets) ListArgoWorkflows ¶
func (o *K8sClientsets) ListArgoWorkflows(options metav1.ListOptions, namespace string) (*argotypes.WorkflowList, error)
ListArgoWorkflows ...
func (*K8sClientsets) ListDeployments ¶
func (o *K8sClientsets) ListDeployments(options metav1.ListOptions, namespace string) (*appsv1.DeploymentList, error)
ListDeployments ...
func (*K8sClientsets) ListJobs ¶
func (o *K8sClientsets) ListJobs(options metav1.ListOptions, namespace string) (*batch.JobList, error)
ListJobs ...
func (*K8sClientsets) ListPods ¶
func (o *K8sClientsets) ListPods(options metav1.ListOptions, namespace string) (*v1.PodList, error)
ListPods ...
func (*K8sClientsets) ScaleDeployment ¶
func (o *K8sClientsets) ScaleDeployment(name, namespace string, replicas int32) error
ScaleDeployment ...
func (*K8sClientsets) UpdateArgoWorkflow ¶
func (o *K8sClientsets) UpdateArgoWorkflow(workflow *argotypes.Workflow, namespace string) (*argotypes.Workflow, error)
UpdateArgoWorkflow ...
func (*K8sClientsets) UpdateDeployment ¶
func (o *K8sClientsets) UpdateDeployment(deployment *appsv1.Deployment, namespace string) (*appsv1.Deployment, error)
UpdateDeployment ...
func (*K8sClientsets) UpdateDestinationRule ¶
func (o *K8sClientsets) UpdateDestinationRule(dr *istio.DestinationRule, namespace string) (*istio.DestinationRule, error)
UpdateDestinationRule ...
func (*K8sClientsets) UpdateGateway ¶
func (o *K8sClientsets) UpdateGateway(gateway *istio.Gateway, namespace string) (*istio.Gateway, error)
UpdateGateway ...
func (*K8sClientsets) UpdateScaledObject ¶
func (o *K8sClientsets) UpdateScaledObject(scaledObject *unstructured.Unstructured, namespace string) (*unstructured.Unstructured, error)
UpdateScaledObject ...
func (*K8sClientsets) UpdateSecret ¶
UpdateSecret ...
func (*K8sClientsets) UpdateService ¶
UpdateService ...
func (*K8sClientsets) UpdateServiceEntry ¶
func (o *K8sClientsets) UpdateServiceEntry(se *istio.ServiceEntry, namespace string) (*istio.ServiceEntry, error)
UpdateServiceEntry ...
func (*K8sClientsets) UpdateVirtualService ¶
func (o *K8sClientsets) UpdateVirtualService(vs *istio.VirtualService, namespace string) (*istio.VirtualService, error)
UpdateVirtualService ...
type MockedAdapter ¶
MockedAdapter for testing
func (MockedAdapter) Create ¶
func (d MockedAdapter) Create(collectionName string, document NafigosBase) error
Create ...
func (MockedAdapter) Delete ¶
func (d MockedAdapter) Delete(collectionName, id string) error
Delete ...
func (MockedAdapter) Read ¶
func (d MockedAdapter) Read(collectionName, id string) ([]byte, error)
Read ...
func (MockedAdapter) ReadFor ¶
func (d MockedAdapter) ReadFor(collectionName, key, value string) ([]map[string]interface{}, error)
ReadFor ...
func (MockedAdapter) ReadForUser ¶
func (d MockedAdapter) ReadForUser(collectionName, owner string) ([]map[string]interface{}, error)
ReadForUser ...
func (MockedAdapter) Replace ¶
func (d MockedAdapter) Replace(collectionName string, document NafigosBase) error
Replace ...
func (MockedAdapter) Update ¶
func (d MockedAdapter) Update(collectionName string, document NafigosBase) error
Update ...
type NafigosBase ¶
NafigosBase is a base interface type for Nafigos entities that need to be stored
type Repository ¶
type Repository struct { RawURL string `bson:"rawurl" json:"rawurl,omitempty"` URL string `bson:"url" json:"url,omitempty"` Branch string `bson:"branch" json:"branch,omitempty"` }
Repository contains basic information required to interact with git The URL is the RawURL without the leading `https://` in order to use as an ID and the RawURL is saved for cloning
type Request ¶
type Request interface { GetClusterID() string GetRegistrySecretID() string GetGitSecretID() string GetWorkflowID() string GetBuildID() string GetRunID() string GetUser() User GetError() Error SetClusterID(value string) SetRegistrySecretID(value string) SetGitSecretID(value string) SetWorkflowID(value string) SetBuildID(value string) SetRunID(value string) SetUser(value User) }
Request is an interface that allows for reading common HTTP request fields and can be extended by service-specific types for reading additional fields
type Secret ¶
type Secret struct { Username string `json:"username,omitempty"` Value string `json:"value,omitempty"` Type SecretType `json:"type,omitempty"` ID string `json:"id,omitempty"` }
Secret ...
func (*Secret) GetRedacted ¶
GetRedacted will return a new Secret with the Value set to "REDACTED"
type SecretType ¶
type SecretType string
SecretType associates a type with a Secret
const ( // GCRSecret is used for Google Container Registry GCRSecret SecretType = "gcr" // DockerhubSecret is used for Dockerhub DockerhubSecret SecretType = "dockerhub" // GitSecret is used for Github, GitLab, etc. GitSecret SecretType = "git" )
type User ¶
type User struct { Username string `json:"username,omitempty"` Password string `json:"password,omitempty,omitempty"` Secrets map[string]Secret `json:"secrets,omitempty"` Clusters map[string]Cluster `json:"clusters,omitempty"` IsAdmin bool `json:"is_admin"` }
User defines user attributes, primarily Secrets that are written to Vault. Note that the Password field is only used for creating the User
func (*User) GetRedacted ¶
GetRedacted will return a new User with sensitive fields redacted