Skip to content

Commit

Permalink
added resource kind to the GetJobID method to avoid interceptions of …
Browse files Browse the repository at this point in the history
…scheduled jobs
  • Loading branch information
Bohdan Siryk authored and testisnullus committed Jan 2, 2024
1 parent 542c127 commit a57e86c
Show file tree
Hide file tree
Showing 20 changed files with 21 additions and 27 deletions.
2 changes: 1 addition & 1 deletion apis/clusterresources/v1beta1/awsencryptionkey_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type AWSEncryptionKeyList struct {
}

func (aws *AWSEncryptionKey) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(aws).String() + "/" + jobName
return aws.Kind + "/" + client.ObjectKeyFromObject(aws).String() + "/" + jobName
}

func (aws *AWSEncryptionKey) NewPatch() client.Patch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ type AWSEndpointServicePrincipal struct {
Status AWSEndpointServicePrincipalStatus `json:"status,omitempty"`
}

func (r *AWSEndpointServicePrincipal) NewPatch() client.Patch {
return client.MergeFrom(r.DeepCopy())
func (p *AWSEndpointServicePrincipal) NewPatch() client.Patch {
return client.MergeFrom(p.DeepCopy())
}

func (r *AWSEndpointServicePrincipal) GetJobID(job string) string {
return r.Namespace + "/" + r.Name + "/" + job
func (p *AWSEndpointServicePrincipal) GetJobID(job string) string {
return p.Kind + "/" + p.Namespace + "/" + p.Name + "/" + job
}

//+kubebuilder:object:root=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type AWSSecurityGroupFirewallRuleList struct {
}

func (fr *AWSSecurityGroupFirewallRule) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(fr).String() + "/" + jobName
return fr.Kind + "/" + client.ObjectKeyFromObject(fr).String() + "/" + jobName
}

func (fr *AWSSecurityGroupFirewallRule) NewPatch() client.Patch {
Expand Down
2 changes: 1 addition & 1 deletion apis/clusterresources/v1beta1/awsvpcpeering_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ type AWSVPCPeeringList struct {
}

func (aws *AWSVPCPeering) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(aws).String() + "/" + jobName
return aws.Kind + "/" + client.ObjectKeyFromObject(aws).String() + "/" + jobName
}

func (aws *AWSVPCPeering) NewPatch() client.Patch {
Expand Down
2 changes: 1 addition & 1 deletion apis/clusterresources/v1beta1/azurevnetpeering_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ type AzureVNetPeeringList struct {
}

func (azure *AzureVNetPeering) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(azure).String() + "/" + jobName
return azure.Kind + "/" + client.ObjectKeyFromObject(azure).String() + "/" + jobName
}

func (azure *AzureVNetPeering) NewPatch() client.Patch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type ClusterNetworkFirewallRuleList struct {
}

func (fr *ClusterNetworkFirewallRule) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(fr).String() + "/" + jobName
return fr.Kind + "/" + client.ObjectKeyFromObject(fr).String() + "/" + jobName
}

func (fr *ClusterNetworkFirewallRule) NewPatch() client.Patch {
Expand Down
2 changes: 1 addition & 1 deletion apis/clusterresources/v1beta1/gcpvpcpeering_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type GCPVPCPeeringList struct {
}

func (gcp *GCPVPCPeering) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(gcp).String() + "/" + jobName
return gcp.Kind + "/" + client.ObjectKeyFromObject(gcp).String() + "/" + jobName
}

func (gcp *GCPVPCPeering) NewPatch() client.Patch {
Expand Down
2 changes: 1 addition & 1 deletion apis/clusterresources/v1beta1/maintenanceevents_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ type MaintenanceEventsList struct {
}

func (me *MaintenanceEvents) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(me).String() + "/" + jobName
return me.Kind + "/" + client.ObjectKeyFromObject(me).String() + "/" + jobName
}

func (me *MaintenanceEvents) NewPatch() client.Patch {
Expand Down
2 changes: 1 addition & 1 deletion apis/clusters/v1beta1/cadence_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func init() {
}

func (c *Cadence) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(c).String() + "/" + jobName
return c.Kind + "/" + client.ObjectKeyFromObject(c).String() + "/" + jobName
}

func (c *Cadence) NewPatch() client.Patch {
Expand Down
2 changes: 1 addition & 1 deletion apis/clusters/v1beta1/cassandra_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ type specificCassandraDC struct {
}

func (c *Cassandra) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(c).String() + "/" + jobName
return c.Kind + "/" + client.ObjectKeyFromObject(c).String() + "/" + jobName
}

func (c *Cassandra) NewPatch() client.Patch {
Expand Down
2 changes: 1 addition & 1 deletion apis/clusters/v1beta1/kafka_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func init() {
}

func (k *Kafka) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(k).String() + "/" + jobName
return k.Kind + "/" + client.ObjectKeyFromObject(k).String() + "/" + jobName
}

func (k *Kafka) NewPatch() client.Patch {
Expand Down
2 changes: 1 addition & 1 deletion apis/clusters/v1beta1/kafkaconnect_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ type KafkaConnectList struct {
}

func (k *KafkaConnect) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(k).String() + "/" + jobName
return k.Kind + "/" + client.ObjectKeyFromObject(k).String() + "/" + jobName
}

func (k *KafkaConnect) NewPatch() client.Patch {
Expand Down
2 changes: 1 addition & 1 deletion apis/clusters/v1beta1/opensearch_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ type OpenSearchList struct {
}

func (os *OpenSearch) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(os).String() + "/" + jobName
return os.Kind + "/" + client.ObjectKeyFromObject(os).String() + "/" + jobName
}

func (os *OpenSearch) NewPatch() client.Patch {
Expand Down
2 changes: 1 addition & 1 deletion apis/clusters/v1beta1/postgresql_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func init() {
}

func (pg *PostgreSQL) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(pg).String() + "/" + jobName
return pg.Kind + "/" + client.ObjectKeyFromObject(pg).String() + "/" + jobName
}

func (pg *PostgreSQL) NewPatch() client.Patch {
Expand Down
2 changes: 1 addition & 1 deletion apis/clusters/v1beta1/redis_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ type immutableRedisDCFields struct {
}

func (r *Redis) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(r).String() + "/" + jobName
return r.Kind + "/" + client.ObjectKeyFromObject(r).String() + "/" + jobName
}

func (r *Redis) NewPatch() client.Patch {
Expand Down
2 changes: 1 addition & 1 deletion apis/clusters/v1beta1/zookeeper_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func init() {
}

func (z *Zookeeper) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(z).String() + "/" + jobName
return z.Kind + "/" + client.ObjectKeyFromObject(z).String() + "/" + jobName
}

func (z *Zookeeper) NewPatch() client.Patch {
Expand Down
2 changes: 1 addition & 1 deletion apis/kafkamanagement/v1beta1/kafkaacl_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type KafkaACLList struct {
}

func (kacl *KafkaACL) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(kacl).String() + "/" + jobName
return kacl.Kind + "/" + client.ObjectKeyFromObject(kacl).String() + "/" + jobName
}

func (kacl *KafkaACL) NewPatch() client.Patch {
Expand Down
4 changes: 0 additions & 4 deletions apis/kafkamanagement/v1beta1/kafkauser_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ type KafkaUserList struct {
Items []KafkaUser `json:"items"`
}

func (ku *KafkaUser) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(ku).String() + "/" + jobName
}

func (ku *KafkaUser) NewPatch() client.Patch {
old := ku.DeepCopy()
return client.MergeFrom(old)
Expand Down
2 changes: 1 addition & 1 deletion apis/kafkamanagement/v1beta1/mirror_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (m *Mirror) NewPatch() client.Patch {
}

func (m *Mirror) GetJobID(jobName string) string {
return client.ObjectKeyFromObject(m).String() + "/" + jobName
return m.Kind + "/" + client.ObjectKeyFromObject(m).String() + "/" + jobName
}

func (a *MirrorStatus) IsEqual(b *MirrorStatus) bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,13 @@ import (
"github.com/instaclustr/operator/pkg/instaclustr"
"github.com/instaclustr/operator/pkg/models"
"github.com/instaclustr/operator/pkg/ratelimiter"
"github.com/instaclustr/operator/pkg/scheduler"
)

// OpenSearchEgressRulesReconciler reconciles a OpenSearchEgressRules object
type OpenSearchEgressRulesReconciler struct {
client.Client
Scheme *runtime.Scheme
API instaclustr.API
Scheduler scheduler.Interface
EventRecorder record.EventRecorder
}

Expand Down

0 comments on commit a57e86c

Please sign in to comment.