Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 3 KubernetesKind for istio (kubernetes/istio) #5284

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public class KubernetesApiGroup {
new KubernetesApiGroup("certificates.k8s.io");
public static final KubernetesApiGroup NETWORKING_K8S_IO =
new KubernetesApiGroup("networking.k8s.io");
public static final KubernetesApiGroup NETWORKING_ISTIO_IO =
new KubernetesApiGroup("networking.istio.io");

@Nonnull private final String name;

Expand All @@ -78,6 +80,7 @@ public class KubernetesApiGroup {
RBAC_AUTHORIZATION_K8S_IO,
CERTIFICATES_K8S_IO,
NETWORKING_K8S_IO,
NETWORKING_ISTIO_IO,
NONE);

private KubernetesApiGroup(@Nonnull String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ public class KubernetesKind {
createWithAlias(
"validatingWebhookConfiguration", null, KubernetesApiGroup.ADMISSIONREGISTRATION_K8S_IO);

public static final KubernetesKind VIRTUAL_SERVICE =
createWithAlias("virtualService", null, KubernetesApiGroup.NETWORKING_ISTIO_IO);
public static final KubernetesKind DESTINATION_RULE =
createWithAlias("destinationRule", null, KubernetesApiGroup.NETWORKING_ISTIO_IO);
public static final KubernetesKind GATEWAY =
createWithAlias("gateway", null, KubernetesApiGroup.NETWORKING_ISTIO_IO);

// special kind that should never be assigned to a manifest, used only to represent objects whose
// kind is not in spinnaker's registry
public static final KubernetesKind NONE = createWithAlias("none", null, KubernetesApiGroup.NONE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ public static List<KubernetesKindProperties> getGlobalKindProperties() {
new KubernetesKindProperties(KubernetesKind.CRON_JOB, true),
new KubernetesKindProperties(KubernetesKind.DAEMON_SET, true),
new KubernetesKindProperties(KubernetesKind.DEPLOYMENT, true),
new KubernetesKindProperties(KubernetesKind.DESTINATION_RULE, true),
new KubernetesKindProperties(KubernetesKind.EVENT, true),
new KubernetesKindProperties(KubernetesKind.GATEWAY, true),
new KubernetesKindProperties(KubernetesKind.HORIZONTAL_POD_AUTOSCALER, true),
new KubernetesKindProperties(KubernetesKind.INGRESS, true),
new KubernetesKindProperties(KubernetesKind.JOB, true),
Expand All @@ -62,6 +64,7 @@ public static List<KubernetesKindProperties> getGlobalKindProperties() {
new KubernetesKindProperties(KubernetesKind.STATEFUL_SET, true),
new KubernetesKindProperties(KubernetesKind.STORAGE_CLASS, false),
new KubernetesKindProperties(KubernetesKind.VALIDATING_WEBHOOK_CONFIGURATION, false),
new KubernetesKindProperties(KubernetesKind.VIRTUAL_SERVICE, true),
new KubernetesKindProperties(KubernetesKind.NONE, true));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright 2021 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package com.netflix.spinnaker.clouddriver.kubernetes.op.handler;

import com.netflix.spinnaker.clouddriver.kubernetes.caching.agent.KubernetesCachingAgentFactory;
import com.netflix.spinnaker.clouddriver.kubernetes.caching.agent.KubernetesCoreCachingAgent;
import com.netflix.spinnaker.clouddriver.kubernetes.description.SpinnakerKind;
import com.netflix.spinnaker.clouddriver.kubernetes.description.manifest.KubernetesKind;
import com.netflix.spinnaker.clouddriver.kubernetes.description.manifest.KubernetesManifest;
import com.netflix.spinnaker.clouddriver.kubernetes.model.Manifest;
import javax.annotation.Nonnull;
import org.springframework.stereotype.Component;

@Component
public class KubernetesDestinationRuleHandler extends KubernetesHandler {
@Override
public int deployPriority() {
return KubernetesHandler.DeployPriority.MOUNTABLE_DATA_PRIORITY.getValue();
}

@Nonnull
@Override
public KubernetesKind kind() {
return KubernetesKind.DESTINATION_RULE;
}

@Override
public boolean versioned() {
return false;
}

@Nonnull
@Override
public SpinnakerKind spinnakerKind() {
return SpinnakerKind.CONFIGS;
}

@Override
public Manifest.Status status(KubernetesManifest manifest) {
return Manifest.Status.defaultStatus();
}

@Override
protected KubernetesCachingAgentFactory cachingAgentFactory() {
return KubernetesCoreCachingAgent::new;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright 2021 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package com.netflix.spinnaker.clouddriver.kubernetes.op.handler;

import com.netflix.spinnaker.clouddriver.kubernetes.caching.agent.KubernetesCachingAgentFactory;
import com.netflix.spinnaker.clouddriver.kubernetes.caching.agent.KubernetesCoreCachingAgent;
import com.netflix.spinnaker.clouddriver.kubernetes.description.SpinnakerKind;
import com.netflix.spinnaker.clouddriver.kubernetes.description.manifest.KubernetesKind;
import com.netflix.spinnaker.clouddriver.kubernetes.description.manifest.KubernetesManifest;
import com.netflix.spinnaker.clouddriver.kubernetes.model.Manifest;
import javax.annotation.Nonnull;
import org.springframework.stereotype.Component;

@Component
public class KubernetesGatewayHandler extends KubernetesHandler {
@Override
public int deployPriority() {
return DeployPriority.MOUNTABLE_DATA_PRIORITY.getValue();
}

@Nonnull
@Override
public KubernetesKind kind() {
return KubernetesKind.GATEWAY;
}

@Override
public boolean versioned() {
return false;
}

@Nonnull
@Override
public SpinnakerKind spinnakerKind() {
return SpinnakerKind.CONFIGS;
}

@Override
public Manifest.Status status(KubernetesManifest manifest) {
return Manifest.Status.defaultStatus();
}

@Override
protected KubernetesCachingAgentFactory cachingAgentFactory() {
return KubernetesCoreCachingAgent::new;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.netflix.spinnaker.clouddriver.kubernetes.op.handler;

import com.netflix.spinnaker.clouddriver.kubernetes.caching.agent.KubernetesCachingAgentFactory;
import com.netflix.spinnaker.clouddriver.kubernetes.caching.agent.KubernetesCoreCachingAgent;
import com.netflix.spinnaker.clouddriver.kubernetes.description.SpinnakerKind;
import com.netflix.spinnaker.clouddriver.kubernetes.description.manifest.KubernetesKind;
import com.netflix.spinnaker.clouddriver.kubernetes.description.manifest.KubernetesManifest;
import com.netflix.spinnaker.clouddriver.kubernetes.model.Manifest;
import javax.annotation.Nonnull;
import org.springframework.stereotype.Component;

@Component
public class KubernetesVirtualServiceHandler extends KubernetesHandler {
@Override
public int deployPriority() {
return DeployPriority.MOUNTABLE_DATA_PRIORITY.getValue();
}

@Nonnull
@Override
public KubernetesKind kind() {
return KubernetesKind.VIRTUAL_SERVICE;
}

@Override
public boolean versioned() {
return false;
}

@Nonnull
@Override
public SpinnakerKind spinnakerKind() {
return SpinnakerKind.CONFIGS;
}

@Override
public Manifest.Status status(KubernetesManifest manifest) {
return Manifest.Status.defaultStatus();
}

@Override
protected KubernetesCachingAgentFactory cachingAgentFactory() {
return KubernetesCoreCachingAgent::new;
}
}